:root {
  --bg: #f4f7ff;
  --bg-2: #fdf4ff;
  --card: #ffffffee;
  --ink: #2b2f45;
  --muted: #5d6382;      /* 5.3:1 על לבן */
  --line: #dfe3f2;
  --field-line: #8a90b0; /* גבול שדות – 3.1:1 מול לבן (WCAG 1.4.11) */
  --primary: #4760d6;    /* טקסט לבן: 5.4:1 */
  --primary-2: #6a4fd6;  /* טקסט לבן: 5.7:1 */
  --link: #3f55c4;
  --danger: #c2344a;     /* 5.4:1 */
  --ok: #1c7f55;         /* 5.0:1 */
  --focus: #1f3fbf;
  --radius: 22px;
  --shadow: 0 20px 50px -20px rgba(80, 90, 160, .35);
  --zoom: 1;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Rubik", "Arial Hebrew", Arial, system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%);
  background-color: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* פוקוס מקלדת בולט בכל האתר */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.field input:focus-visible { outline: none; }

.skip-link {
  position: absolute; top: -100px; right: 16px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- רקע מרחף ---------- */
.bg-shapes { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-shapes span {
  position: absolute;
  bottom: -60px;
  font-weight: 700;
  opacity: .18;
  animation: floatUp linear infinite;
  user-select: none;
}
@keyframes floatUp {
  from { transform: translateY(0) rotate(0deg); }
  to   { transform: translateY(-120vh) rotate(360deg); }
}

/* ---------- מבנה ---------- */
.stage {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 32px 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1;
}
.stage:focus { outline: none; }

.brand { text-align: center; margin-bottom: 20px; animation: drop .7s cubic-bezier(.2,.9,.3,1.3) both; }
.logo {
  width: 64px; height: 64px; margin: 0 auto 8px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: grid; place-items: center;
  box-shadow: 0 12px 24px -8px rgba(71, 96, 214, .6);
  animation: wobble 4s ease-in-out infinite;
}
.logo span { color: #fff; font-size: 34px; font-weight: 800; }
.brand h1 { margin: 0; font-size: 34px; letter-spacing: 1px; }
.tagline { margin: 4px 0 0; color: var(--muted); }

@keyframes drop { from { opacity: 0; transform: translateY(-24px); } to { opacity: 1; transform: none; } }
@keyframes wobble { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) scale(1.04); } }

/* ---------- כרטיס ---------- */
.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px 22px;
}
.view { animation: cardIn .45s cubic-bezier(.2,.9,.3,1.15) both; }
.view.leaving { animation: cardOut .22s ease-in both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes cardOut { to { opacity: 0; transform: translateY(-10px) scale(.98); } }

.card h2 { margin: 0 0 4px; font-size: 24px; text-wrap: balance; }
.sub { margin: 0 0 20px; color: var(--muted); line-height: 1.5; }

/* ---------- שדות ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 6px; }
.field input:not([type="checkbox"]) {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--field-line);
  background: #fff;
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s, transform .15s;
}
.field input::placeholder { color: #6e7391; }
.field input:not([type="checkbox"]):focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(71,96,214,.22); }
.field.invalid input:not([type="checkbox"]) { border-color: var(--danger); animation: shake .35s; }
.field.valid input:not([type="checkbox"]) { border-color: #5fae88; }
.err { display: block; color: var(--danger); font-size: 13px; margin-top: 4px; font-weight: 500; }
.err:empty { display: none; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.pass-wrap { position: relative; }
.pass-wrap input { padding-left: 48px !important; }
.eye {
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer; font-size: 18px; opacity: .7;
  min-width: 36px; min-height: 36px; border-radius: 8px;
}
.eye:hover, .eye.on { opacity: 1; }

.strength { height: 6px; border-radius: 99px; background: var(--line); margin-top: 8px; overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .3s, background .3s; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink); margin: 4px 0 16px; cursor: pointer; line-height: 1.6; }
.field .check { margin: 0; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.inline-link {
  font: inherit; border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--link); font-weight: 600; text-decoration: underline; text-underline-offset: 2px;
}

/* ---------- כפתורים ---------- */
.btn {
  width: 100%;
  font: inherit; font-weight: 600; font-size: 17px;
  padding: 13px 18px;
  border: 0; border-radius: 14px;
  cursor: pointer;
  color: #fff;
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 10px 22px -10px rgba(71,96,214,.8); }
.btn.ghost { background: #fff; color: var(--ink); border: 2px solid var(--line); }
.btn.small { width: auto; font-size: 14px; padding: 9px 16px; margin: 0; }
.btn.danger { background: var(--danger); }
.btn.danger-ghost { background: #fff; color: var(--danger); border: 2px solid #eab3bc; }

.switch { text-align: center; margin: 16px 0 0; color: var(--muted); font-size: 15px; }
.switch.small { font-size: 13px; margin-top: 6px; }
.switch a { color: var(--link); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* =====================================================
   מצב אפליקציה רחב (נושאים / נושא)
   ===================================================== */
body.wide .stage { max-width: 1080px; padding-top: 16px; }
body.wide .brand { display: none; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px;
  background: #ffffffcc; backdrop-filter: blur(10px);
  border: 1px solid #fff; border-radius: 18px; padding: 10px 14px;
  box-shadow: 0 8px 24px -16px rgba(80,90,160,.4);
  margin-bottom: 22px;
}
.tb-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; }
.tb-logo {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  color: #fff; font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--primary-2));
}
.tb-user { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px 10px; min-width: 0; max-width: 100%; }
.tb-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.tb-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}
.back-btn {
  font: inherit; font-weight: 600; border: 0; background: #eef1ff; color: #4d62c9;
  padding: 8px 14px; border-radius: 12px; cursor: pointer; transition: transform .15s, background .2s;
}
.back-btn:hover { background: #e2e8ff; transform: translateX(3px); }

/* ---------- Hero + בחירת יחידות ---------- */
.topics-hero { text-align: center; margin-bottom: 22px; }
.topics-hero h1 { font-size: clamp(24px, 4vw, 34px); margin: 0 0 6px; }
.topics-hero .sub { margin-bottom: 18px; }

.unit-picker {
  --i: 0;
  position: relative; display: inline-grid; grid-template-columns: repeat(3, 1fr);
  background: #fff; padding: 5px; border-radius: 18px; border: 1px solid var(--line);
  box-shadow: 0 10px 26px -16px rgba(80,90,160,.5);
  width: min(420px, 100%);
}
.unit-picker button {
  position: relative; z-index: 1; font: inherit; font-weight: 700; font-size: 17px;
  border: 0; background: none; padding: 12px 8px; cursor: pointer; color: var(--muted);
  border-radius: 14px; transition: color .25s;
}
.unit-picker button[aria-checked="true"] { color: #fff; }
.unit-picker button:focus-visible { outline: 3px solid rgba(108,140,255,.4); outline-offset: 2px; }
.up-glider {
  position: absolute; top: 5px; bottom: 5px; right: 5px; width: calc((100% - 10px) / 3);
  border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 18px -8px rgba(108,140,255,.8);
  transform: translateX(calc(var(--i) * -100%));
  transition: transform .45s cubic-bezier(.3,1.4,.4,1);
}
.unit-exams { font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.unit-exams b { color: var(--ink); font-weight: 600; }

/* ---------- רשת נושאים ---------- */
.topic-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  transition: opacity .18s, transform .18s;
}
.topic-grid.swap { opacity: 0; transform: translateY(8px) scale(.98); }
.topic-card {
  --bg: #eef1ff; --fg: #6c8cff;
  position: relative; overflow: hidden; text-align: right;
  display: flex; flex-direction: column; gap: 6px;
  aspect-ratio: 1 / 1; padding: 18px;
  font: inherit; color: var(--ink); cursor: pointer;
  background: linear-gradient(160deg, #fff 0%, var(--bg) 100%);
  border: 1px solid #fff; border-radius: 24px;
  box-shadow: 0 14px 30px -20px rgba(60,70,140,.45);
  animation: cardIn .5s cubic-bezier(.2,.9,.3,1.2) both;
  transition: transform .2s, box-shadow .2s;
}
.topic-card::after {
  content: ""; position: absolute; width: 140px; height: 140px; border-radius: 50%;
  left: -40px; top: -40px; background: var(--fg); opacity: .08; transition: transform .35s;
}
.topic-card:hover { transform: translateY(-5px) rotate(-.5deg); box-shadow: 0 22px 36px -20px rgba(60,70,140,.55); }
.topic-card:hover::after { transform: scale(1.35); }
.topic-card:hover .tc-icon { transform: scale(1.12) rotate(-8deg); }
.topic-card:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
.tc-icon {
  font-size: 34px; width: 58px; height: 58px; border-radius: 18px;
  display: grid; place-items: center; background: #fff;
  box-shadow: 0 6px 14px -8px var(--fg); transition: transform .3s cubic-bezier(.3,1.6,.5,1);
}
.tc-name { font-weight: 700; font-size: 17px; line-height: 1.3; margin-top: 6px; }
.tc-blurb { font-size: 13px; color: var(--muted); line-height: 1.45; }
.tc-foot { margin-top: auto; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; }
.tc-exam { background: #fff; color: var(--fg); font-weight: 600; padding: 3px 8px; border-radius: 99px; direction: ltr; white-space: nowrap; max-width: 100%; overflow-wrap: anywhere; }
html.a11y-zoom .tc-exam { white-space: normal; }
html.a11y-zoom .tb-me { min-width: 0; max-width: 100%; }
.tc-done { color: var(--muted); font-weight: 500; }
.tc-bar { height: 6px; background: #ffffffaa; border-radius: 99px; overflow: hidden; }
.tc-bar i { display: block; height: 100%; background: var(--fg); border-radius: 99px; transition: width .6s; }

/* ---------- דף נושא ---------- */
.topic-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.topic-head h1 { margin: 0 0 6px; font-size: clamp(22px, 3.5vw, 30px); }
.topic-icon {
  font-size: 38px; width: 68px; height: 68px; border-radius: 22px; flex: none;
  display: grid; place-items: center; background: #fff; box-shadow: var(--shadow);
  animation: pop .5s cubic-bezier(.2,.9,.3,1.5) both;
}
@keyframes pop { from { transform: scale(0) rotate(-20deg); } to { transform: none; } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: #eef1ff; color: #4d62c9; }

.focus-box {
  background: #fffaf0; border: 1px solid #ffe6b8; border-radius: 16px;
  padding: 12px 16px; margin-bottom: 18px; font-size: 14.5px;
}
.focus-box summary { cursor: pointer; font-weight: 500; color: #7a5200; }
.focus-box ul { margin: 10px 0 4px; padding-right: 20px; line-height: 1.7; }
.focus-src { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

/* =====================================================
   נגן השיעור
   ===================================================== */
.player {
  background: #fff; border-radius: 24px; padding: 10px; margin-bottom: 26px;
  box-shadow: 0 24px 50px -24px rgba(60,70,140,.5); border: 1px solid #fff;
}
.screen {
  container-type: inline-size;
  position: relative; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden;
  background: linear-gradient(180deg, #eaf0ff 0%, #f6efff 70%, #ffe9f1 100%);
}
.scr-bg {
  position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(#c9d3ff 1.2px, transparent 1.2px);
  background-size: 22px 22px;
}
/* לוח */
.board {
  position: absolute; left: 2.5%; top: 5%; width: 52%; height: 88%;
  background: #fff; border-radius: 2cqw; border: .5cqw solid #dfe5fb;
  box-shadow: 0 1.2cqw 2.4cqw -1.2cqw rgba(60,70,140,.35);
  padding: 2.2cqw 2.6cqw; display: flex; flex-direction: column; gap: 1.2cqw;
  transition: width .5s cubic-bezier(.3,1.2,.5,1);
}
.board-title {
  font-size: max(1.5cqw, 12px); font-weight: 700; color: #5d6382; letter-spacing: .02em;
  border-bottom: .2cqw dashed #e3e7f7; padding-bottom: .8cqw;
}
.board-lines { display: flex; flex-direction: column; gap: 1.1cqw; }
.bl {
  font-size: 2.35cqw; font-weight: 600; color: #34395a; line-height: 1.35;
  animation: write .55s ease-out both;
  unicode-bidi: plaintext;
}
.bl[dir="auto"] { text-align: start; }
.bl sup { font-size: .6em; }
@keyframes write {
  from { opacity: 0; clip-path: inset(0 0 0 100%); transform: translateY(.5cqw); }
  to   { opacity: 1; clip-path: inset(0 0 0 0); transform: none; }
}
.bl.hl { color: #1f2a6b; }
.bl.hl .mk {
  padding: .2cqw 1cqw; border-radius: .8cqw;
  background: linear-gradient(90deg, #fff3a8 0%, #ffe57a 100%) no-repeat;
  background-size: 100% 100%;
  animation: marker .7s .3s ease-out both;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.bl.hl.wait { opacity: 0; animation: none; }
.bl.hl.wait .mk { animation: none; }
@keyframes marker { from { background-size: 0% 100%; } to { background-size: 100% 100%; } }

/* מחשבון */
.calc {
  position: absolute; left: 57%; bottom: 5%; width: 17.5%;
  background: linear-gradient(180deg, #3b3f5c, #2b2f45); border-radius: 1.6cqw;
  padding: 1cqw; box-shadow: 0 1.4cqw 2.4cqw -1cqw rgba(20,20,60,.6);
  transform: translateY(130%) rotate(6deg); opacity: 0;
  transition: transform .55s cubic-bezier(.3,1.4,.5,1), opacity .3s;
}
.calc.on { transform: none; opacity: 1; }
.calc-display {
  background: #d9f2df; border-radius: .7cqw; padding: .6cqw .8cqw; margin-bottom: .9cqw;
  direction: ltr; text-align: left; font-family: "Courier New", monospace;
  min-height: 5.2cqw; display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: inset 0 .2cqw .6cqw rgba(0,0,0,.2);
}
.calc-expr { font-size: 1.05cqw; color: #2d5a3a; word-break: break-all; min-height: 1.3cqw; }
.calc-res { font-size: 2cqw; font-weight: 700; color: #123d20; text-align: right; min-height: 2.4cqw; }
.calc-res.pop { animation: resPop .5s cubic-bezier(.3,1.8,.5,1); }
@keyframes resPop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: none; opacity: 1; } }
.calc-keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: .45cqw; direction: ltr; }
.ck {
  font-size: .95cqw; font-weight: 600; color: #e7e9ff; text-align: center;
  background: #50557a; border-radius: .5cqw; padding: .55cqw 0;
  box-shadow: 0 .25cqw 0 #23263a; transition: transform .08s, background .08s, box-shadow .08s;
}
.ck.num { background: #6a6f96; }
.ck.eq { background: #ff9f7a; grid-column: span 2; }
.ck.press { background: #ffd45c !important; color: #2b2f45; transform: translateY(.25cqw); box-shadow: 0 0 0 #23263a, 0 0 1.4cqw #ffd45c; }

/* דמות */
.char {
  position: absolute; right: 1.5%; bottom: 0; width: 23%; height: 64%;
  animation: bob 3s ease-in-out infinite;
  transform-origin: bottom center;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-1.2%); } }
.kipi { width: 100%; height: 100%; overflow: visible; }
.k-shadow { fill: rgba(60,70,140,.15); }
.k-hoodie { fill: #7c8cff; }
.k-hood-line { fill: none; stroke: #5d6be0; stroke-width: 4; stroke-linecap: round; }
.k-string { stroke: #fff; stroke-width: 2.5; stroke-linecap: round; }
.k-tip { fill: #fff; }
.k-logo { fill: #fff; font: 800 22px Rubik, sans-serif; opacity: .9; }
.k-sleeve { fill: none; stroke: #7c8cff; stroke-width: 20; stroke-linecap: round; }
.k-skin { fill: #ffd8b8; }
.k-hair { fill: #3b2f4a; }
.k-phones { fill: none; stroke: #ff8f63; stroke-width: 6; stroke-linecap: round; }
.k-phones-band { fill: none; stroke: #ff8f63; stroke-width: 7; stroke-linecap: round; opacity: 0; }
.k-cup { fill: #ff8f63; }
.k-brows path { fill: none; stroke: #3b2f4a; stroke-width: 4; stroke-linecap: round; transition: transform .3s; }
.k-eyes ellipse { fill: #2b2f45; }
.k-glint { fill: #fff; }
.k-eyes { transform-origin: 100px 104px; animation: blink 4.2s infinite; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.k-cheek { fill: #ff9fb4; opacity: .5; }
.k-smile { fill: none; stroke: #2b2f45; stroke-width: 4; stroke-linecap: round; }
.k-mouth { fill: #7a2e3b; opacity: 0; transform-origin: 100px 134px; }
.char.talking .k-smile { opacity: 0; }
.char.talking .k-mouth { opacity: 1; animation: talk .26s ease-in-out infinite alternate; }
@keyframes talk { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
.k-arm { transition: transform .5s cubic-bezier(.3,1.4,.5,1); }
.k-arm-right { transform-origin: 152px 196px; }
.k-arm-left { transform-origin: 48px 196px; }
.char.mood-wave .k-arm-right { animation: wave 1s ease-in-out 2; }
@keyframes wave { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-18deg); } 75% { transform: rotate(12deg); } }
.char.pointing .k-arm-left { transform: rotate(62deg); }
.char.mood-think .k-brows path:first-child { transform: translateY(-4px) rotate(-6deg); transform-origin: 80px 88px; }
.char.mood-think .k-head { animation: tilt 2.4s ease-in-out infinite; transform-origin: 100px 160px; }
@keyframes tilt { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-5deg); } }
.char.mood-wow .k-brows path { transform: translateY(-6px); }
.char.mood-wow { animation: jump .9s cubic-bezier(.3,1.6,.5,1) 2; }
@keyframes jump { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-7%); } }

/* בועת דיבור */
.bubble {
  position: absolute; right: 3%; top: 5%; width: 40%;
  background: #fff; border-radius: 2cqw; padding: 1.5cqw 1.9cqw;
  font-size: 1.75cqw; line-height: 1.5; font-weight: 500; color: var(--ink);
  box-shadow: 0 1.2cqw 2.4cqw -1.2cqw rgba(60,70,140,.45);
  opacity: 0; transform: scale(.85); transform-origin: 70% 100%;
}
.bubble::after {
  content: ""; position: absolute; bottom: -1.4cqw; right: 22%;
  border: 1.5cqw solid transparent; border-top-color: #fff; border-bottom: 0;
}
.bubble.show { animation: bubbleIn .45s cubic-bezier(.3,1.5,.5,1) forwards; }
@keyframes bubbleIn { to { opacity: 1; transform: none; } }

/* פוסטר ומסך סיום */
.poster, .endcard {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2cqw;
  background: linear-gradient(135deg, rgba(71,96,214,.93), rgba(106,79,214,.93));
  color: #fff; text-align: center; transition: opacity .4s, visibility .4s;
  backdrop-filter: blur(2px);
}
.poster.gone { opacity: 0; visibility: hidden; }
.poster-play {
  width: 10cqw; height: 10cqw; min-width: 56px; min-height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: #fff; color: var(--primary); font-size: max(3.6cqw, 22px); padding-left: .6cqw;
  box-shadow: 0 0 0 0 rgba(255,255,255,.6); animation: pulse 1.8s infinite;
  transition: transform .2s;
}
.poster-play:hover { transform: scale(1.08); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.6); } 100% { box-shadow: 0 0 0 3cqw rgba(255,255,255,0); } }
.poster-title { font-size: max(3cqw, 18px); font-weight: 800; }
.poster-sub { font-size: max(1.5cqw, 12px); opacity: .9; }
.endcard { background: linear-gradient(135deg, rgba(61,191,164,.92), rgba(108,140,255,.92)); animation: cardIn .4s both; }
.end-title { font-size: max(2.8cqw, 18px); font-weight: 800; }
.end-actions { display: flex; gap: 10px; }
.end-actions .btn.ghost { border-color: transparent; }

/* פקדים */
.controls { display: flex; align-items: center; gap: 6px; padding: 10px 4px 2px; }
.pc {
  font: inherit; border: 0; background: #f1f3fb; color: var(--ink); cursor: pointer;
  width: 38px; height: 38px; border-radius: 12px; font-size: 15px; flex: none;
  display: grid; place-items: center; transition: background .2s, transform .15s;
}
.pc:hover { background: #e4e8fa; }
.pc:active { transform: scale(.94); }
.pc.play { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; width: 44px; height: 44px; border-radius: 14px; }
.pc.small-t { font-size: 13px; font-weight: 700; width: 44px; }
.pc.disabled { opacity: .45; }
.segments { flex: 1; display: flex; gap: 4px; margin: 0 6px; }
.seg { flex: 1; height: 8px; border: 0; padding: 0; border-radius: 99px; background: #e6e9f6; cursor: pointer; overflow: hidden; }
.seg i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 99px; }
.seg.done i { width: 100%; }
.seg.active i { animation: segFill 9s linear forwards; }
.seg.active.paused i { animation-play-state: paused; }
@keyframes segFill { from { width: 8%; } to { width: 100%; } }

/* נגן בטלפון – פריסה אנכית */
@media (max-width: 620px) {
  .screen { aspect-ratio: 3 / 4; }
  .board { left: 3%; top: 3%; width: 94%; height: 39%; padding: 3.5cqw 4cqw; border-radius: 4cqw; gap: 2cqw; }
  .board-title { font-size: max(3.2cqw, 12px); }
  .bl { font-size: 4.4cqw; }
  .bubble { right: 3%; top: 44%; width: 94%; font-size: 3.8cqw; padding: 3cqw 3.6cqw; border-radius: 4cqw; }
  .bubble::after { right: 18%; bottom: -2.6cqw; border-width: 2.8cqw; border-bottom: 0; }
  .calc { left: 4%; bottom: 3%; width: 42%; padding: 2cqw; border-radius: 3cqw; }
  .calc-display { min-height: 11cqw; padding: 1.4cqw 1.8cqw; border-radius: 1.6cqw; margin-bottom: 1.8cqw; }
  .calc-expr { font-size: 2.6cqw; min-height: 3cqw; }
  .calc-res { font-size: 4.8cqw; min-height: 5.6cqw; }
  .calc-keys { gap: 1cqw; }
  .ck { font-size: 2.2cqw; padding: 1.2cqw 0; border-radius: 1cqw; }
  .char { width: 36%; height: 36%; right: 4%; }
  .controls { flex-wrap: wrap; }
  .segments { order: 10; flex-basis: 100%; margin: 8px 0 0; }
}

/* =====================================================
   תרגילים
   ===================================================== */
.ex-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ex-head h2 { margin: 0; font-size: 22px; }
.ex-progress { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ok); font-size: 14px; }
.ex-meter { width: 120px; height: 8px; background: #e6e9f6; border-radius: 99px; overflow: hidden; }
.ex-meter i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 99px; transition: width .6s cubic-bezier(.3,1.4,.5,1); }
.ex-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); }
.ex-card {
  position: relative; background: #fff; border: 2px solid transparent; border-radius: 20px;
  padding: 18px; box-shadow: 0 12px 28px -20px rgba(60,70,140,.5);
  animation: cardIn .45s cubic-bezier(.2,.9,.3,1.2) both;
  transition: border-color .3s, background .3s;
}
.ex-card.solved { border-color: #bfead3; background: linear-gradient(180deg, #fff 60%, #effbf5); }
.ex-card.shake { animation: shake .35s; }
.ex-top { display: flex; gap: 12px; align-items: flex-start; }
.ex-num {
  flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  background: #eef1ff; color: #4d62c9; font-weight: 700; font-size: 14px;
}
.ex-card.solved .ex-num { background: var(--ok); color: #fff; }
.ex-q { line-height: 1.75; font-size: 15.5px; min-width: 0; }
.m { unicode-bidi: isolate; font-weight: 600; color: #2d3570; white-space: nowrap; }
.m-list { white-space: normal; }
/* נוסחה ארוכה בתרגיל/בפתרון: עוברת שורה בשלמותה, ורק אם היא רחבה מהמסך – נשברת בין הרווחים */
.ex-card .m { display: inline-block; max-width: 100%; white-space: normal; text-indent: 0; }
.m sup, .m sub { font-size: .7em; }
.ex-answer { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 12px; }
.ans-field {
  display: flex; align-items: center; direction: ltr;
  border: 2px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.ans-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(108,140,255,.15); }
.ans-label { padding: 0 10px; font-weight: 600; color: var(--muted); background: #f6f7fc; align-self: stretch; display: grid; place-items: center; font-size: 14px; white-space: nowrap; }
.ans-field input { font: inherit; font-size: 16px; border: 0; outline: 0; padding: 9px 10px; width: 110px; background: transparent; color: var(--ink); }
.ans-field:has(input.ok) { border-color: var(--ok); }
.ans-field:has(input.bad) { border-color: var(--danger); }
.ans-field input:disabled { color: var(--ok); font-weight: 700; }
.choices { gap: 8px; }
.choice {
  font: inherit; cursor: pointer; padding: 9px 14px; border-radius: 12px;
  border: 2px solid var(--line); background: #fff; transition: border-color .2s, background .2s, transform .15s;
}
.choice:hover { transform: translateY(-2px); }
.choice.sel { border-color: var(--primary); background: #eef1ff; }
.choice.wrong { border-color: var(--danger); background: #fff0f2; }
.choice.right { border-color: var(--ok); background: #eafaf2; }
.ex-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ex-actions .btn.small { width: auto; padding: 8px 18px; }
.linkbtn {
  font: inherit; font-size: 14px; border: 0; background: none; cursor: pointer;
  color: var(--muted); padding: 8px 10px; border-radius: 10px; transition: background .2s, color .2s;
}
.linkbtn:hover { background: #f1f3fb; color: var(--ink); }
.ex-feedback { font-weight: 600; font-size: 14.5px; min-height: 0; margin-top: 0; opacity: 0; transition: opacity .2s; }
.ex-feedback.show { opacity: 1; margin-top: 10px; animation: cardIn .3s both; }
.ex-feedback.ok { color: var(--ok); }
.ex-feedback.bad { color: var(--danger); }
.ex-feedback.info { color: var(--muted); }
.ex-hint { margin-top: 10px; background: #fffaf0; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.7; animation: cardIn .3s both; }
.ex-steps { margin: 12px 0 0; padding: 12px 34px 12px 14px; background: #f6f8ff; border-radius: 12px; line-height: 1.9; font-size: 14.5px; }
.ex-steps li { animation: cardIn .4s both; }
.ex-steps li.final { font-weight: 700; color: #4d62c9; list-style: none; margin-top: 4px; margin-right: -20px; }
.more-btn { display: block; width: auto; margin: 18px auto 0; padding: 12px 26px; }

.burst { position: absolute; left: 50%; top: 40%; pointer-events: none; }
.burst i {
  position: absolute; width: 8px; height: 8px; border-radius: 2px;
  animation: burst .8s cubic-bezier(.2,.8,.3,1) forwards;
}
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) rotate(200deg); opacity: 0; } }

@media (max-width: 520px) {
  .topic-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .topic-card { padding: 12px; border-radius: 18px; aspect-ratio: auto; min-height: 170px; }
  .tc-icon { width: 46px; height: 46px; font-size: 26px; border-radius: 14px; }
  .tc-name { font-size: 15px; }
  .tc-blurb { font-size: 12px; }
  .tb-name { display: none; }
  .ex-card { padding: 14px; }
}

/* ---------- טוסט ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px;
  font-size: 15px; z-index: 10; max-width: calc(100% - 32px);
  transition: transform .35s cubic-bezier(.2,.9,.3,1.3);
}
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =====================================================
   כפתור פרופיל/הגדרות בסרגל העליון
   ===================================================== */
.tb-me {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  font: inherit; color: var(--ink); background: #fff; cursor: pointer;
  border: 2px solid var(--line); border-radius: 999px; padding: 3px 12px 3px 4px;
  transition: border-color .2s, box-shadow .2s;
}
.tb-me:hover { border-color: var(--primary); box-shadow: 0 6px 16px -10px rgba(71,96,214,.7); }
.tb-gear { display: grid; color: var(--muted); transition: transform .4s; }
.tb-me:hover .tb-gear { transform: rotate(90deg); }

/* =====================================================
   כותרת תחתונה
   ===================================================== */
.site-foot {
  position: relative; z-index: 1;
  padding: 18px 16px calc(84px + env(safe-area-inset-bottom, 0px));
  text-align: center; font-size: 13px; color: var(--muted);
}
.site-foot ul { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; }
.foot-link {
  font: inherit; font-size: 13.5px; border: 0; background: none; cursor: pointer;
  color: var(--link); text-decoration: underline; text-underline-offset: 3px; padding: 6px 8px; border-radius: 8px;
}
.foot-link:hover { background: #eef1ff; }
.foot-note { margin: 0 auto; max-width: 60ch; line-height: 1.6; }

/* =====================================================
   חלונות (הגדרות / מסמכים)
   ===================================================== */
dialog.sheet {
  width: min(560px, calc(100% - 24px)); max-height: min(88vh, 900px);
  border: 0; border-radius: 22px; padding: 0; color: var(--ink); background: #fff;
  box-shadow: 0 30px 80px -20px rgba(30,40,100,.5);
  overflow: auto; overscroll-behavior: contain;
}
dialog.sheet[open] { animation: cardIn .35s cubic-bezier(.2,.9,.3,1.15) both; }
dialog.sheet::backdrop { background: rgba(30,35,70,.45); backdrop-filter: blur(3px); }
.sheet-head {
  position: sticky; top: 0; z-index: 2; background: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px 12px; border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font-size: 21px; }
.sheet-close {
  width: 38px; height: 38px; border-radius: 12px; border: 0; background: #f1f3fb;
  font-size: 16px; cursor: pointer; color: var(--ink); flex: none;
}
.sheet-close:hover { background: #e4e8fa; }
.set-block { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.set-block:last-child { border-bottom: 0; }
.set-block h3 { margin: 0 0 12px; font-size: 16px; }
.set-current { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.set-current b { color: var(--ink); }
.set-text { margin: 0 0 12px; font-size: 14px; line-height: 1.7; color: var(--muted); }
.set-text b { color: var(--ink); font-weight: 600; }
/* "רגע, כבר הולכים?" – קיפי קופץ כשיוצאים מנושא */
dialog.nudge { width: min(400px, calc(100% - 32px)); padding: 26px 24px 16px; text-align: center; overflow: visible; }
dialog.nudge[open] { animation: nudgeIn .55s cubic-bezier(.2,1.4,.4,1) both; }
.nudge-x { position: absolute; top: 12px; inset-inline-end: 12px; display: grid; place-items: center; }
.nudge-hero { position: relative; width: 132px; height: 132px; margin: -84px auto 6px; }
.nudge-rays {
  position: absolute; inset: -18px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, #ffc36b33 0 12deg, transparent 12deg 30deg);
  animation: spin 9s linear infinite;
}
.nudge-kipi {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: 34px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 16px 30px -12px rgba(71,96,214,.9), 0 0 0 6px #fff;
  animation: kipiJump .9s .2s cubic-bezier(.3,1.6,.5,1) both, kipiBounce 1.8s 1.2s ease-in-out infinite;
}
.nudge-kipi .logo-face { width: 78%; height: 78%; }
.nudge-count {
  position: absolute; bottom: -8px; inset-inline-start: -10px; min-width: 46px; height: 46px; padding: 0 8px;
  display: grid; place-items: center; border-radius: 999px; border: 4px solid #fff;
  background: #ff8a5c; color: #fff; font-size: 22px; font-weight: 800;
  animation: countPop .5s .75s cubic-bezier(.3,1.8,.5,1) both;
}
dialog.nudge h2 { margin: 6px 0 8px; font-size: 24px; font-weight: 800; }
dialog.nudge p { margin: 0 0 18px; font-size: 16px; line-height: 1.6; color: var(--muted); }
.nudge-actions { display: grid; gap: 8px; }
.nudge-actions .btn { width: 100%; }
#nudge-more { font-size: 17px; animation: nudgePulse 1.6s 1.4s ease-in-out infinite; }
.nudge-never { margin-top: 8px; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; }
.ex-card.spotlight { animation: spotlight 1.6s ease-out; }
@keyframes nudgeIn { from { opacity: 0; transform: translateY(40px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes kipiJump {
  0% { transform: translateY(60px) scale(.3) rotate(-25deg); opacity: 0; }
  60% { transform: translateY(-14px) scale(1.08) rotate(6deg); opacity: 1; }
  100% { transform: none; }
}
@keyframes kipiBounce { 0%,100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-7px) rotate(-4deg); } 60% { transform: translateY(0) rotate(3deg); } }
@keyframes countPop { from { transform: scale(0) rotate(-90deg); } to { transform: none; } }
@keyframes nudgePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes spotlight { 0% { box-shadow: 0 0 0 0 rgba(71,96,214,.55); } 40% { box-shadow: 0 0 0 10px rgba(71,96,214,.25); } 100% { box-shadow: 0 0 0 0 rgba(71,96,214,0); } }

.danger-zone { margin-top: 14px; padding: 14px; border-radius: 14px; background: #fff3f5; border: 1px solid #f1c4cc; }
.danger-zone p { margin: 0 0 12px; font-size: 14px; line-height: 1.6; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; }

/* מסמכים משפטיים */
.legal-body { padding: 8px 22px 26px; line-height: 1.8; font-size: 15px; }
.legal-body h3 { font-size: 17px; margin: 22px 0 6px; }
.legal-body p, .legal-body ul { margin: 0 0 10px; max-width: 65ch; }
.legal-body ul { padding-right: 20px; }
.legal-body a { color: var(--link); }
.legal-date { color: var(--muted); font-size: 13px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 6px 0 12px; display: block; overflow-x: auto; }
.legal-table th, .legal-table td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.legal-table th { background: #f4f6fd; font-weight: 600; }
mark.todo { background: #fff0a8; color: #5c4400; padding: 0 4px; border-radius: 4px; }

/* =====================================================
   הודעת עוגיות
   ===================================================== */
.cookie-banner {
  position: fixed; z-index: 40; left: 16px; right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 16px 18px 16px 84px;
  box-shadow: 0 20px 50px -18px rgba(30,40,100,.45);
  animation: cardIn .45s cubic-bezier(.2,.9,.3,1.15) both;
}
.cb-text { flex: 1 1 300px; }
.cb-text h2 { margin: 0 0 4px; font-size: 16px; }
.cb-text p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); }
.cb-text b { color: var(--ink); }
.cb-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* =====================================================
   תפריט נגישות
   ===================================================== */
.a11y-fab {
  position: fixed; z-index: 45; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: 52px; height: 52px; border-radius: 50%; border: 3px solid #fff; cursor: pointer;
  background: var(--focus); color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 24px -8px rgba(31,63,191,.7); transition: transform .2s;
}
.a11y-fab:hover { transform: scale(1.07); }
.a11y-fab svg { width: 28px; height: 28px; fill: currentColor; }
.a11y-panel {
  position: fixed; z-index: 46; left: 16px; bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  width: min(300px, calc(100% - 32px));
  background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px;
  box-shadow: 0 24px 60px -20px rgba(30,40,100,.5);
  display: flex; flex-direction: column; gap: 10px;
  animation: cardIn .3s both;
}
.a11y-panel h2 { margin: 0 0 2px; font-size: 17px; }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.a11y-size { display: flex; align-items: center; gap: 6px; }
.a11y-size button {
  font: inherit; font-weight: 700; width: 40px; height: 36px; border-radius: 10px;
  border: 2px solid var(--field-line); background: #fff; color: var(--ink); cursor: pointer;
}
.a11y-size output { min-width: 44px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.a11y-toggle {
  display: flex; align-items: center; gap: 10px; font-size: 14.5px; cursor: pointer;
  padding: 8px 10px; border-radius: 10px; background: #f6f7fc;
}
.a11y-toggle input { width: 20px; height: 20px; accent-color: var(--focus); margin: 0; }
.a11y-foot { display: flex; justify-content: space-between; gap: 8px; }
.a11y-foot .linkbtn { color: var(--link); text-decoration: underline; }

/* --- מצבי נגישות --- */
html.a11y-zoom .stage, html.a11y-zoom .site-foot, html.a11y-zoom dialog.sheet { zoom: var(--zoom); }
/* בהגדלה – רוחב/גובה החלונות מחולקים בזום, כדי שאחרי ההגדלה עדיין ייכנסו למסך */
/* (בתוך אלמנט מוגדל, 100% כבר נמדד ביחידות המוגדלות – לכן רק השוליים מחולקים בזום) */
html.a11y-zoom dialog.sheet {
  --dw: min(560px, calc(100% - 24px / var(--zoom)));
  width: var(--dw); max-width: none; max-height: calc(88vh / var(--zoom));
  left: 0; right: 0; margin-inline: auto;
}
html.a11y-zoom dialog.nudge { --dw: min(400px, calc(100% - 32px / var(--zoom))); max-height: none; }
html.a11y-zoom .nudge-hero { width: 96px; height: 96px; margin-top: -62px; }
html.a11y-zoom .nudge-kipi { border-radius: 26px; }
html.a11y-zoom .nudge-count { min-width: 38px; height: 38px; font-size: 18px; }
html.a11y-contrast {
  --muted: #2b2f45; --line: #5d6382; --field-line: #2b2f45; --link: #1a2d99; --card: #fff;
}
html.a11y-contrast body { background: #fff; }
html.a11y-contrast .bg-shapes { display: none; }
html.a11y-contrast .card, html.a11y-contrast .topic-card, html.a11y-contrast .ex-card,
html.a11y-contrast .topbar, html.a11y-contrast .player { border: 2px solid #2b2f45; box-shadow: none; background: #fff; }
html.a11y-contrast .tc-blurb, html.a11y-contrast .tc-done { color: #2b2f45; }
html.a11y-motion *, html.a11y-motion *::before, html.a11y-motion *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
}
html.a11y-motion .bg-shapes { display: none; }
html.a11y-links a, html.a11y-links button:not(.ck) { text-decoration: underline !important; text-underline-offset: 3px; }
html.a11y-links a:not(.btn), html.a11y-links .inline-link, html.a11y-links .foot-link, html.a11y-links .linkbtn { background: #fff3a8 !important; color: #1a2d99 !important; }
html.a11y-font body, html.a11y-font button, html.a11y-font input { font-family: Arial, "Arial Hebrew", sans-serif !important; letter-spacing: .01em; }
html.a11y-font .bl, html.a11y-font .ex-q { line-height: 1.9; }

@media (max-width: 520px) {
  .tb-me { padding-left: 10px; }
  .cookie-banner { left: 12px; right: 12px; padding: 14px; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
}

/* =====================================================
   אייקונים (SVG)
   ===================================================== */
.ico { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.22em; }
.tc-icon { color: var(--fg); }
.tc-icon .ico { width: 30px; height: 30px; }
.topic-icon { color: var(--primary); }
.topic-icon .ico { width: 38px; height: 38px; }
.eye { display: grid; place-items: center; color: var(--muted); }
.eye .ico { width: 20px; height: 20px; }
.sheet-close { display: grid; place-items: center; }
.sheet-close .ico { width: 18px; height: 18px; }
.tb-gear .ico { width: 18px; height: 18px; }
.pc .ico { width: 20px; height: 20px; }
.pc.play .ico { width: 22px; height: 22px; }
.poster-play { display: grid; place-items: center; padding: 0 0 0 .5cqw; }
.poster-play .ico { width: 42%; height: 42%; }
.end-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.end-actions .ico { width: 18px; height: 18px; }
.ex-hint b { font-weight: 600; }
@media (max-width: 520px) {
  .tc-icon .ico { width: 24px; height: 24px; }
}
/* =====================================================
   הנתונים שלי
   ===================================================== */
.tb-stats {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 14px; color: var(--primary);
  background: #eef1ff; border: 2px solid transparent; border-radius: 999px;
  padding: 7px 14px; cursor: pointer; transition: border-color .2s, background .2s;
}
.tb-stats:hover { border-color: var(--primary); background: #e6ebff; }
.tb-stats .ico { width: 18px; height: 18px; }
.tb-stats > span[data-icon] { display: grid; }

.unit-picker.four { grid-template-columns: repeat(4, 1fr); width: min(440px, 100%); }
.unit-picker.four .up-glider { width: calc((100% - 10px) / 4); }
.unit-picker.four button { font-size: 16px; }

.stats-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.stats-head h1 { margin: 0 0 4px; font-size: clamp(24px, 3.6vw, 32px); }
.stats-head .sub { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  background: #fff; border: 1px solid #fff; border-radius: 18px; padding: 16px 18px;
  box-shadow: 0 12px 28px -22px rgba(60,70,140,.55);
  animation: cardIn .45s cubic-bezier(.2,.9,.3,1.15) both;
}
.kpi:nth-child(2) { animation-delay: 50ms; }
.kpi:nth-child(3) { animation-delay: 100ms; }
.kpi:nth-child(4) { animation-delay: 150ms; }
.kpi-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi-value { font-size: 32px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi.hero .kpi-value { color: var(--primary); }
.kpi-sub { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.kpi-delta { font-weight: 600; }
.kpi-delta.up { color: var(--ok); }
.kpi-delta.down { color: var(--muted); }

.panel {
  background: #fff; border: 1px solid #fff; border-radius: 22px; padding: 18px 20px 20px;
  box-shadow: 0 16px 36px -26px rgba(60,70,140,.55); margin-bottom: 16px;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.panel-head .linkbtn { color: var(--link); text-decoration: underline; text-underline-offset: 3px; flex: none; }

.chart-wrap { position: relative; }
.chart { display: block; width: 100%; height: auto; overflow: visible; font-family: inherit; }
.chart:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 8px; }
.c-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 5; }
.c-base { stroke: #c4c9e2; stroke-width: 1.2; }
.c-ylab, .c-xlab { fill: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.c-line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.c-end { fill: var(--primary); stroke: #fff; stroke-width: 2.5; }
.c-cross { stroke: var(--field-line); stroke-width: 1; stroke-dasharray: 3 3; }
.c-dot { fill: #fff; stroke: var(--primary); stroke-width: 2.5; }
.c-hit { cursor: crosshair; }
/* מצב המנוחה גלוי; האנימציה רק מוסיפה "ציור" בכניסה */
.chart-wrap.drawn .c-line { stroke-dasharray: var(--len); animation: drawLine 1s cubic-bezier(.4,.1,.2,1); }
.chart-wrap.drawn .c-area { animation: fadeArea .9s .25s backwards; }
.chart-wrap.drawn .c-end { animation: pop .4s .9s cubic-bezier(.2,.9,.3,1.6) backwards; transform-box: fill-box; transform-origin: center; }
@keyframes drawLine { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
@keyframes fadeArea { from { opacity: 0; } to { opacity: 1; } }

.chart-tip {
  position: absolute; z-index: 3; transform: translateX(-50%); pointer-events: none;
  background: var(--ink); color: #fff; border-radius: 10px; padding: 6px 10px;
  font-size: 12.5px; line-height: 1.45; text-align: center; white-space: nowrap;
  box-shadow: 0 8px 20px -8px rgba(20,25,60,.5);
}
.chart-tip b { display: block; font-size: 14px; }
.chart-empty {
  position: absolute; inset: 0 0 30px 34px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  text-align: center; color: var(--muted); font-size: 14.5px;
}
.chart-empty p { margin: 0; background: #ffffffd9; padding: 4px 10px; border-radius: 8px; }

.chart-table-wrap { margin-top: 12px; max-height: 320px; overflow: auto; border-radius: 12px; border: 1px solid var(--line); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--line); }
.data-table th { position: sticky; top: 0; background: #f4f6fd; font-weight: 600; }
.data-table td:last-child, .data-table th:last-child { text-align: left; font-variant-numeric: tabular-nums; }

.topic-bars { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 12px; }
.topic-bars li { display: flex; align-items: center; gap: 12px; }
.tbar-icon {
  flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: #eef1ff; color: var(--primary);
}
.tbar-icon .ico { width: 20px; height: 20px; }
.tbar-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tbar-top { display: flex; align-items: baseline; gap: 8px; }
.tbar-name { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbar-unit { font-size: 12px; color: var(--muted); flex: none; }
.tbar-val { margin-inline-start: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.tbar-track { height: 8px; background: #eef0f8; border-radius: 99px; overflow: hidden; }
.tbar-track i { display: block; height: 100%; background: var(--primary); border-radius: 99px; animation: growBar .7s cubic-bezier(.3,1,.4,1) both; transform-origin: right; }
@keyframes growBar { from { transform: scaleX(0); } }
.tb-empty { color: var(--muted); font-size: 14px; }

@media (max-width: 820px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .tb-stats-label { display: none; }
  .tb-stats { padding: 8px; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 26px; }
  .panel { padding: 14px 14px 16px; border-radius: 18px; }
  .unit-picker.four button { font-size: 15px; padding: 10px 4px; }
}

/* ביטוי מתמטי בתוך שורה עברית: יחידה אחת, משמאל לימין, בלי שבירה באמצע */
.bl span[dir="ltr"] { display: inline-block; unicode-bidi: isolate; white-space: nowrap; }
/* =====================================================
   ציורים מונפשים על הלוח
   ===================================================== */
.board-lines { flex: 1; min-height: 0; }
.bl.fig { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; animation: none; clip-path: none; }
.figsvg { width: 100%; height: 100%; max-height: 100%; overflow: visible; direction: ltr; font-family: "Rubik", Arial, sans-serif; }
.figsvg text { fill: #2b2f45; font-weight: 600; font-size: 15px; }
.figsvg .ln { fill: none; stroke: #2b2f45; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.figsvg .ln.pr { stroke: #4760d6; } .figsvg .ln.ac { stroke: #d9642f; } .figsvg .ln.ok { stroke: #1c7f55; }
.figsvg .ln.bad { stroke: #c2344a; } .figsvg .ln.mu { stroke: #b3b8d0; stroke-width: 2; }
.figsvg .ln.thick { stroke-width: 4; } .figsvg .ln.dash { stroke-dasharray: 6 6; }
.figsvg .mk-ink { fill: #2b2f45; } .figsvg .mk-pr { fill: #4760d6; } .figsvg .mk-ac { fill: #d9642f; } .figsvg .mk-ok { fill: #1c7f55; } .figsvg .mk-bad { fill: #c2344a; }
.figsvg .f-ink { fill: #2b2f45; } .figsvg .f-ac { fill: #d9642f; } .figsvg .f-red { fill: #d8436f; } .figsvg .f-blue { fill: #4760d6; }
.figsvg .f-prl { fill: rgba(71,96,214,.16); } .figsvg .f-acl { fill: rgba(217,100,47,.18); }
.figsvg .f-okl { fill: rgba(28,127,85,.18); } .figsvg .f-badl { fill: rgba(194,52,74,.12); } .figsvg .f-plane { fill: rgba(71,96,214,.08); }
.figsvg .prt { fill: #4760d6; } .figsvg .acc { fill: #c2551f; } .figsvg .okt { fill: #1c7f55; } .figsvg .badt { fill: #c2344a; } .figsvg .mut { fill: #5d6382; font-weight: 500; }
.figsvg .chip { fill: #fff; stroke: #b3b8d0; stroke-width: 2; } .figsvg .chip.hot { fill: #fff3a8; stroke: #d9642f; }
.figsvg .note { fill: #fff8d6; stroke: #e6c65c; stroke-width: 2; }
.figsvg .calcb { fill: #33374f; } .figsvg .lcd { fill: #d9f2df; }
.figsvg .lcdm { fill: #2d5a3a; font-size: 12px; } .figsvg .lcdt { fill: #123d20; font-family: "Courier New", monospace; } .figsvg .calct { fill: #c9cce0; font-weight: 500; }
/* אנימציות: מצב המנוחה גלוי (forwards) */
.figsvg .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: figDraw .8s cubic-bezier(.4,.1,.2,1) var(--t, 0s) forwards; }
.figsvg .pop { opacity: 0; transform-box: fill-box; transform-origin: center; animation: figPop .45s cubic-bezier(.2,.9,.3,1.4) var(--t, 0s) forwards; }
.figsvg .grow { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); animation: figGrow .5s cubic-bezier(.2,.9,.3,1.2) var(--t, 0s) forwards; }
@keyframes figDraw { to { stroke-dashoffset: 0; } }
@keyframes figPop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes figGrow { to { transform: scaleY(1); } }
.figsvg .f-okb { fill: #5fb58c; } .figsvg .f-badb { fill: #e0788a; }

/* בטלפון: בשלב עם ציור – הלוח גדל, הבועה עוברת לצד הדמות */
@media (max-width: 620px) {
  .screen.with-fig .board { height: 55%; }
  .screen.with-fig .bubble { top: 58%; right: auto; left: 3%; width: 68%; }
  .screen.with-fig .bubble::after { display: none; }
  .screen.with-fig .char { width: 27%; height: 31%; right: 2%; }
}
/* כרטיס תמיכה בדף הנושאים */
.support-card { --bg: #e9f6f0; --fg: #147a62; cursor: default; }
.support-card:hover { transform: none; }
.support-card:hover::after { transform: none; }
.support-card:hover .tc-icon { transform: none; }
.support-card h2.tc-name, .support-card p.tc-blurb { margin: 0; }
.sup-mail {
  font-weight: 700; font-size: 14px; color: #0f5e4b; text-decoration: underline; text-underline-offset: 3px;
  overflow-wrap: break-word; user-select: all; margin-top: auto;
}
.sup-copy {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; align-self: flex-start;
  font: inherit; font-size: 13px; font-weight: 600; color: #fff; background: #147a62;
  border: 0; border-radius: 10px; padding: 7px 12px; cursor: pointer; transition: filter .2s;
}
.sup-copy:hover { filter: brightness(1.1); }
.sup-copy .ico { width: 16px; height: 16px; }
@media (max-width: 520px) { .sup-mail { font-size: 12.5px; } .sup-long { display: none; } }
/* לוגו קיפי: פנים של קיפי בתוך הריבוע הסגול */
.logo, .tb-logo { overflow: hidden; }
.logo .logo-face, .tb-logo .logo-face { width: 100%; height: 100%; display: block; }
.logo { animation: wobble 4s ease-in-out infinite; }
/* נגישות: שטח לחיצה של 24px לפחות לפסי השלבים (WCAG 2.5.8), והפס עצמו נשאר דק */
.seg { position: relative; height: 26px; background: transparent !important; overflow: visible; }
.seg::before { content: ""; position: absolute; inset-inline: 0; top: 9px; height: 8px; border-radius: 99px; background: #e6e9f6; }
.seg i { position: absolute; inset-inline-start: 0; top: 9px; height: 8px; }
/* כותרת שמקבלת פוקוס אחרי מעבר מסך – בלי מסגרת (היא לא כפתור) */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }
/* =====================================================
   מסכי חשבון: אישור אימייל, איפוס סיסמה, טעינה
   ===================================================== */
.center-card { text-align: center; }
.center-card .sub { margin-bottom: 12px; }
.big-icon { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 20px; display: grid; place-items: center; background: #eef1ff; color: var(--primary); }
.big-icon .ico { width: 32px; height: 32px; }
.small-note { font-size: 14px; }
.center-row { justify-content: center; margin-top: 8px; }
.forgot-row { margin: -4px 0 14px; font-size: 14px; }
.forgot-row a { color: var(--link); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.nowrap { white-space: nowrap; }
/* קישורי טקסט: אזור לחיצה גדול יותר לאצבע (בלי לשנות את המראה והמרווחים) */
.switch a, .forgot-row a, .inline-link { padding-block: 12px; } /* ריפוד אנכי בטקסט רציף לא מזיז את השורות */
.set-current.pending { color: #7a5200; background: #fffaf0; border-radius: 10px; padding: 8px 10px; }
.spinner {
  width: 44px; height: 44px; margin: 8px auto 14px; border-radius: 50%;
  border: 4px solid #e3e7f7; border-top-color: var(--primary); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
[aria-busy="true"] .chart-wrap { opacity: .5; transition: opacity .2s; }