/* ===== בסיס ===== */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1c1d21;
  --muted: #5b6472;
  --ctl-line: #8a909c;   /* גבול פקדים — ניגודיות 3:1 */
  --line: #e6e7eb;
  --accent: #2f6df6;
  --accent-soft: #e8f0ff;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 28px rgba(16,24,40,.08);
  --sheet-ink: #15181f;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Rubik", "Heebo", -apple-system, "Segoe UI", system-ui, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; }

/* ===== סרגל עליון ===== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; font-size: 19px;
  background: linear-gradient(135deg, #2f6df6, #4f8bff); color: #fff;
  box-shadow: 0 4px 12px rgba(47,109,246,.35);
}
.brand small { display:block; font-size: 11.5px; font-weight: 500; color: var(--muted); margin-top: -2px; }
.spacer { flex: 1; }
.tb-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 15px; border-radius: 11px; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; transition: .15s;
}
.tb-btn:hover { background: #f7f8fa; }
a.tb-btn { text-decoration: none; }
.tb-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 14px rgba(47,109,246,.3); }
.tb-btn.primary:hover { filter: brightness(1.05); }

/* ===== פריסה ===== */
.layout { display: grid; grid-template-columns: 384px 1fr; gap: 0; align-items: start; }
.panel {
  position: sticky; top: var(--topbar-h); align-self: start;
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  background: var(--panel); border-inline-start: 1px solid var(--line);
  padding: 18px 18px 60px;
}
.preview-area { padding: 28px 20px 80px; min-height: calc(100vh - var(--topbar-h)); }

/* ===== קבוצות בפאנל ===== */
.group { margin-bottom: 22px; }
.group > h2 { font-size: 12.5px; letter-spacing: .02em; color: var(--muted); font-weight: 700; margin-bottom: 10px; text-transform: none; }

.grades { display: flex; flex-wrap: wrap; gap: 6px; }
.grade {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 14px; font-size: 14px; font-weight: 600; color: var(--muted); transition: .15s;
}
.grade.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* רשת נושאים */
.topics { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.topic {
  text-align: start; border: 1.5px solid var(--line); background: #fff;
  border-radius: 14px; padding: 11px 12px; display: flex; flex-direction: column; gap: 2px;
  transition: .15s; position: relative;
}
.topic:hover { border-color: #cfd6e4; transform: translateY(-1px); }
.topic.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(47,109,246,.12); }
.t-ic { font-size: 20px; }
.t-nm { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.t-gr { font-size: 12px; color: #4b5563; }

/* אפשרויות מותאמות */
.opt-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 11px; }
.opt-label { flex: 0 0 76px; font-size: 13px; color: var(--muted); padding-top: 6px; font-weight: 500; }
.opt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; transition: .12s;
}
.chip:hover { border-color: #cfd6e4; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.opt-none { font-size: 13px; color: var(--muted); margin: 0; }

/* מדרגות + מקטעים */
.field { margin-bottom: 13px; }
.field > label, .field-label { display: block; font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.levels { display: flex; gap: 6px; }
.lvl { flex: 1; border: 1.5px solid var(--line); background: #fff; border-radius: 11px; padding: 8px 0; font-size: 15px; color: var(--muted); transition: .12s; }
.lvl.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.stepper { display: inline-flex; align-items: center; gap: 0; border: 1.5px solid var(--line); border-radius: 11px; overflow: hidden; }
.stepper button { width: 38px; height: 38px; border: none; background: #fff; font-size: 20px; color: var(--ink); }
.stepper button:hover { background: #f2f4f7; }
.stepper .val { min-width: 46px; text-align: center; font-weight: 700; font-size: 15px; }
.inline-fields { display: flex; gap: 18px; flex-wrap: wrap; }

.seg-group { display: inline-flex; border: 1.5px solid var(--line); border-radius: 11px; overflow: hidden; }
.seg { border: none; background: #fff; padding: 8px 16px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.seg + .seg { border-inline-start: 1.5px solid var(--line); }
.seg.on { background: var(--ink); color: #fff; }

.check { display: flex; align-items: center; gap: 9px; font-size: 14px; padding: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.text-input { width: 100%; border: 1.5px solid var(--line); border-radius: 11px; padding: 9px 12px; font-size: 14px; font-family: inherit; }
.text-input:focus { border-color: var(--accent); }

/* ===== דף A4 ===== */
#preview { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.sheet {
  width: 210mm; min-height: 297mm; background: #fff; color: var(--sheet-ink);
  box-shadow: var(--shadow); border-radius: 4px; padding: 16mm 15mm 14mm;
  display: flex; flex-direction: column;
}
.sheet-head { border-bottom: 2.5px solid var(--accent); padding-bottom: 10px; margin-bottom: 14px; }
.sheet.bw .sheet-head { border-color: #222; }
.sh-row { display: flex; align-items: baseline; justify-content: space-between; }
.sh-title { font-size: 22px; font-weight: 800; margin: 0; }
.sh-brand { font-size: 12px; color: var(--muted); font-weight: 600; }
.sheet.bw .sh-brand { color: #555; }
.sh-name { display: flex; gap: 22px; flex-wrap: wrap; font-size: 14px; color: #333; margin-top: 10px; }

.ex-grid { display: grid; gap: 7mm 9mm; flex: 1; align-content: start; }
.ex-grid.cols-1 { grid-template-columns: 1fr; }
.ex-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.ex-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.ex { display: flex; align-items: center; gap: 9px; font-size: 20px; }
.ex-v { align-items: flex-start; }
.ex-num {
  flex: 0 0 auto; min-width: 25px; height: 25px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: inline-grid; place-items: center; font-size: 12.5px; font-weight: 700; margin-top: 2px;
}
.sheet.bw .ex-num { background: #eee; color: #333; }
.ex-body { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; font-weight: 600; letter-spacing: .01em; }
.ex-rtl { align-items: flex-start; }
.ex-rtl .ex-body { font-size: 16px; font-weight: 500; line-height: 1.6; }
.ex-rtl .ans-box { width: 60px; }
.ex-note { font-size: 12px; color: var(--muted); margin-inline-start: 4px; }

.ans-box { display: inline-block; width: 46px; height: 1.4em; border-bottom: 2px solid #b9c0cc; }
.sheet.bw .ans-box { border-color: #888; }
.inbox { display: inline-block; min-width: 30px; height: 1.25em; border: 2px solid #b9c0cc; border-radius: 6px; vertical-align: -4px; }
.sheet.bw .inbox { border-color: #888; }
.ans-val { color: #c01f45; font-weight: 800; margin-inline-start: 4px; }
.sheet.bw .ans-val { color: #000; text-decoration: underline; }

/* תרגיל במאונך */
.vsum { display: inline-grid; justify-items: end; font-variant-numeric: tabular-nums; line-height: 1.15; }
.vrow { display: inline-flex; gap: 2px; position: relative; }
.vd { display: inline-block; width: .62em; text-align: center; }
.vop { position: absolute; inset-inline-start: -.9em; }
.vline { height: 2.5px; background: var(--sheet-ink); width: 100%; margin-top: 3px; }
.vans { display: block; height: 8mm; width: 100%; }
.answers .vans { display: none; }
.ex-v .ans-val { align-self: flex-start; margin-top: 4px; }

/* ===== מצב תרגול דיגיטלי ===== */
.topbar-seg { margin-inline-start: 6px; }
.digi-bar {
  position: sticky; top: var(--topbar-h); z-index: 20;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  max-width: 210mm; margin: 0 auto 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 14px; box-shadow: var(--shadow);
}
.digi-hint { font-size: 12.5px; color: var(--muted); }
.score-chip { font-weight: 800; font-size: 15.5px; padding: 6px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.score-chip.good { background: #e7f8ee; color: #146c3a; }
.score-chip.mid { background: #fff4e0; color: #8a5300; }
.score-chip.low { background: #fde8ee; color: #c01f45; }

.quiz { max-width: 210mm; margin: 0 auto; background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 20px 24px 26px; }
.quiz-title { font-size: 20px; font-weight: 800; border-bottom: 2.5px solid var(--accent); padding-bottom: 8px; margin-bottom: 8px; }
.qd { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid #f0f1f4; flex-wrap: wrap; }
.qd .ex-num { flex: 0 0 auto; }
.qd .ex-body { font-size: 19px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; letter-spacing: .01em; }
.qd.ex-rtl .ex-body { font-size: 16.5px; font-weight: 500; }
.qd.ex-diagram .ex-body { display: block; width: 100%; }
.qd-ans { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.dig-in {
  width: 88px; font-family: inherit; font-size: 17px; font-weight: 700; text-align: center;
  border: 2px solid var(--line); border-radius: 9px; padding: 5px 8px; color: var(--ink);
}
.dig-in:focus { border-color: var(--accent); }
.dig-in.ok { border-color: #1a8f4c; background: #eafaf0; }
.dig-in.bad { border-color: #c01f45; background: #fdeef2; }
.qd-mark { font-weight: 800; font-size: 16px; margin-inline-start: auto; min-width: 1em; }
.qd-mark .correct { color: #146c3a; font-weight: 700; font-size: 14px; }
.cmp-btns { display: inline-flex; gap: 4px; margin-inline-start: 4px; }
.cmp-b { border: 1.5px solid var(--line); background: #fff; border-radius: 7px; width: 32px; height: 32px; font-size: 16px; font-weight: 700; color: var(--ink); }
.cmp-b:hover { background: #f2f4f7; border-color: var(--accent); }
@media (max-width: 1040px) { .digi-bar, .quiz { max-width: 100%; } }
@media print { .digi-bar { display: none !important; } }

/* קו כתיבה ארוך (מבנה עשרוני) */
.writeline { display: inline-block; min-width: 62mm; height: 1.25em; border-bottom: 2px solid #b9c0cc; vertical-align: -3px; }
.sheet.bw .writeline { border-color: #888; }

/* תרגיל-דיאגרמה (ציר מספרים) */
.ex-diagram { width: 100%; }
.ex-diagram .ex-body { display: block; width: 100%; }
.ex-diagram .ans-box { margin-top: 6px; }

/* שבר */
.frac { display: inline-flex; flex-direction: column; text-align: center; vertical-align: middle; margin: 0 2px; line-height: 1; }
.frac .num { border-bottom: 2px solid currentColor; padding: 0 5px 1px; }
.frac .den { padding: 1px 5px 0; }

.sheet-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); border-top: 1px solid #eef0f3; padding-top: 8px; margin-top: 12px; }
.sheet.answers { }
.sheet.answers .sheet-head { border-color: #c01f45; }

.hint { font-size: 12px; color: var(--muted); margin: 14px 0 0; text-align: center; }

/* ===== רספונסיב ===== */
@media (max-width: 1040px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; height: auto; border-inline-start: none; border-bottom: 1px solid var(--line); }
  .sheet { width: 100%; min-height: auto; padding: 22px 18px; }
  .topics { grid-template-columns: 1fr 1fr; }
}

/* ===== הדפסה ===== */
@media print {
  @page { size: A4; margin: 0; }
  .topbar, .panel, .hint { display: none !important; }
  .layout { display: block; }
  .preview-area { padding: 0; }
  #preview { gap: 0; display: block; }
  .sheet { width: 210mm; min-height: 297mm; box-shadow: none; border-radius: 0; margin: 0; page-break-after: always; break-after: page; }
  .sheet:last-child { page-break-after: auto; break-after: auto; }
  body { background: #fff; }
}

/* ===== תיבת "זוכרים" — דרכי פתרון ===== */
.help { background: #eef6e6; border: 1px solid #cfe3bd; border-radius: 10px; padding: 9px 14px 10px; margin: 0 0 14px; font-size: 13.5px; line-height: 1.55; color: #1d2a14; }
.help-h { font-weight: 800; font-size: 14.5px; color: #2f5d12; margin-bottom: 3px; }
.help ul { margin: 0; padding-inline-start: 18px; }
.help li { margin: 1px 0; }
.help-ex { margin-top: 6px; background: #fff8e4; border: 1px solid #f0dfae; border-radius: 8px; padding: 5px 10px; }
.help-ex b { color: #7a5400; }
.help .frac, .help-ex .frac { font-size: 12px; }
.sheet.bw .help { background: #f4f4f4; border-color: #bbb; color: #111; }
.sheet.bw .help-h, .sheet.bw .help-ex b { color: #000; }
.sheet.bw .help-ex { background: #fff; border-color: #bbb; }
.quiz .help { margin-top: 10px; }

/* ===== שאלות מילוליות ===== */
.wq-list { display: flex; flex-direction: column; gap: 5mm; flex: 1; }
.wq-q { display: flex; align-items: flex-start; gap: 9px; font-size: 15.5px; line-height: 1.6; }
.wq-text { flex: 1; }
.wq-text .frac { font-size: 13px; }
.wq-tag { flex: 0 0 auto; font-size: 12px; color: var(--muted); border: 1px solid #dde1e8; border-radius: 999px; padding: 0 7px; margin-top: 3px; }
.wq-box { margin: 4px 34px 0 0; height: 25mm; border: 1.5px solid #b9c0cc; border-radius: 8px; position: relative; padding: 4px 10px; }
.wq-lbl { font-size: 11.5px; color: var(--muted); }
.wq-ans { position: absolute; bottom: 6px; inset-inline-start: 10px; font-size: 13.5px; color: #333; }
.wq-sol { margin: 4px 34px 0 0; font-size: 14px; background: #fdf1f4; border-radius: 8px; padding: 6px 10px; line-height: 1.7; }
.wq-way { unicode-bidi: plaintext; }
.sheet.bw .wq-box { border-color: #888; }
.sheet.bw .wq-sol { background: #f2f2f2; }
.quiz-sub { font-size: 17px; font-weight: 800; margin-top: 18px; padding-top: 10px; border-top: 2px solid var(--line); }
.qd-word .ex-body { flex: 1 1 100%; }
.qd-word .qd-ans { margin-inline-start: 34px; }
@media print { .wq-box, .help { break-inside: avoid; } }
#words .seg { padding: 8px 11px; }

/* ===== לוגו Targilio ===== */
.brand { text-decoration: none; flex: 0 0 auto; }
.brand-logo { display: block; height: 56px; width: auto; }
@media (max-width: 700px) { .brand-logo { height: 40px; } }
.sh-brand img { display: block; height: 22px; width: auto; }
.sheet.bw .sh-brand img { filter: grayscale(1); }

[hidden] { display: none !important; }

/* ===== לוגו בולט: כרטיס פתיחה כמו ב-kidsprint ===== */
:root { --topbar-h: 81px; }
.hero {
  max-width: 210mm; margin: 0 auto 22px;
  background: #fff; border-radius: 22px; box-shadow: var(--shadow);
  padding: 30px 24px 24px; text-align: center;
}
.hero-logo { display: block; height: 132px; width: auto; max-width: 100%; margin: 0 auto; }
.hero-sub { margin: 14px auto 0; max-width: 46ch; font-size: 15px; color: var(--muted); line-height: 1.55; }
@media (max-width: 700px) { .hero { padding: 22px 16px 18px; border-radius: 18px; } .hero-logo { height: 96px; } .hero-sub { font-size: 14px; } }
@media print { .hero { display: none !important; } }

/* מסך צר: הפאנל מופיע לפני הדף, ולכן הלוגו הבולט עובר לסרגל העליון */
@media (max-width: 1040px) {
  :root { --topbar-h: 0px; }
  .topbar { position: static; flex-wrap: wrap; justify-content: center; gap: 10px 10px; padding: 16px 16px 12px; }
  .topbar .brand { flex: 1 0 100%; justify-content: center; margin-bottom: 4px; }
  .brand-logo { height: 76px; }
  .topbar .spacer { display: none; }
  .topbar-seg { margin-inline-start: 0; }
  .hero { display: none; }
}
@media (max-width: 420px) {
  .brand-logo { height: 64px; }
  .topbar .seg { padding: 8px 10px; }
  .topbar .tb-btn { padding-inline: 12px; }
}


/* ===================== נגישות (ת"י 5568 / WCAG 2.1 AA) ===================== */
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/rubik-hebrew.woff2) format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/rubik-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Rubik"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/rubik-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: #1d4ed8; color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 12px; }

/* מיקוד מקלדת בולט בכל פקד */
:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }
.seg-group .seg:focus-visible, .stepper button:focus-visible { outline-offset: -3px; }
#preview:focus { outline: none; }

/* גבולות פקדים בניגודיות מספקת */
.chip, .grade, .lvl, .topic, .stepper, .seg-group, .text-input, .dig-in, .cmp-b { border-color: var(--ctl-line); }
.seg + .seg { border-inline-start-color: var(--ctl-line); }
.chip.on, .grade.on, .lvl.on, .topic.on { border-color: var(--accent); }

/* גודל מטרות מגע */
.chip, .grade { min-height: 40px; }
.cmp-b { min-width: 44px; min-height: 44px; }
.stepper button { min-width: 44px; min-height: 44px; }
.seg { min-height: 40px; }

/* סימון נכון/שגוי גם בסמל ולא רק בצבע */
.qd-mark.is-ok { color: #146c3a; }
.qd-mark.is-bad { color: #b4123b; }
.dig-in.bad { border-width: 3px; border-style: dashed; }
.score-chip:empty { display: none; }

.field-gap { margin-top: 10px; }
.noscript { background: #fff4e0; color: #5c3b00; padding: 12px 16px; border-radius: 10px; }
.quiz-title { margin: 0; }
.preview-area { overflow-x: auto; }

/* כותרת תחתונה — הצהרת נגישות, תנאי שימוש, פרטיות */
.site-foot { border-top: 1px solid var(--line); background: var(--panel); padding: 18px 20px 26px; text-align: center; font-size: 14px; color: #4b5563; }
.site-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; margin-bottom: 8px; }
.site-foot a { color: #1d4ed8; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.site-foot p { margin: 0; }
@media print { .site-foot, .skip-link { display: none !important; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) { .on { outline: 3px solid CanvasText; } .inbox, .ans-box, .writeline { border-color: CanvasText; } }

.ex-num { color: #1d4ed8; }

/* הסתייגות מאחריות — גלויה ליד הדף ובתחתית */
.disclaimer { max-width: 210mm; margin: 10px auto 0; font-size: 13px; color: #4b5563; text-align: center; line-height: 1.6; }
.disclaimer a, .foot-disclaimer a { color: #1d4ed8; font-weight: 600; }
.site-foot .foot-disclaimer { margin-top: 6px; font-size: 13px; }
@media print { .disclaimer { display: none !important; } }

/* ===================== גן: תרגילים חזותיים ===================== */
.ex-gan { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 10px 10px; border: 1.5px solid #e3e6ec; border-radius: 14px; }
.ex-gan .ex-num { align-self: flex-start; }
.ex-gan .ex-body, .qd-gan .ex-body { display: flex; flex-direction: column; align-items: stretch; gap: 8px; font-size: 16px; font-weight: 500; line-height: 1.5; }
.gan-ask { font-size: 15px; color: #1f2430; }
.gan-ask .gan-shape { width: 22px; height: 22px; vertical-align: -5px; }
.gan-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; font-size: 26px; font-weight: 700; direction: ltr; }
.gan-pics { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 2px 4px; max-width: 100%; }
.gp { font-size: 28px; line-height: 1.15; }
.gp.gone { position: relative; opacity: .45; }
.gp.gone::after { content: ""; position: absolute; left: -2px; right: -2px; top: 50%; height: 3px; background: #c01f45; transform: rotate(-35deg); }
.gan-op { font-size: 30px; font-weight: 800; padding: 0 2px; }
.gan-line .inbox { min-width: 46px; height: 46px; border-radius: 10px; vertical-align: middle; }
.ex-gan .ans-box { align-self: center; width: 70px; height: 46px; border: 2px solid #b9c0cc; border-radius: 10px; }
.gan-groups, .gan-bars { display: flex; flex-direction: column; gap: 8px; }
.gan-group { display: flex; align-items: center; gap: 10px; border: 1.5px dashed #c9ced8; border-radius: 12px; padding: 6px 10px; }
.gan-tag { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #222; font-size: 17px; }
.gan-shape { width: 38px; height: 38px; }
.gan-shapes { display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; }
.gan-dice { width: 92px; height: 92px; }
.gan-frame { width: 230px; height: auto; max-width: 100%; }
.gan-bar { width: 100%; max-width: 230px; height: 24px; }
.ex-gan .ans-val { align-self: center; }
.sheet.bw .gp { filter: grayscale(1); }
.sheet.bw .gan-shape, .sheet.bw .gan-frame, .sheet.bw .gan-bar { filter: grayscale(1); }
.qd-gan { align-items: flex-start; }
.qd-gan .gan-line { justify-content: flex-start; }
/* השוואה ואורך: שתי הקבוצות זו לצד זו כדי שהדף ייכנס ל-A4 */
.gan-groups, .gan-bars { flex-direction: row; }
.gan-groups .gan-group, .gan-bars .gan-group { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 4px; padding: 6px; }
.gan-groups .gp { font-size: 22px; }
.gan-line.gan-rtl { direction: rtl; }

/* הכנה להדפסה מטלפון: הדפים ברוחב A4 מלא בזמן ההדפסה */
html.printing .sheet { width: 210mm !important; min-height: 297mm !important; padding: 16mm 15mm 14mm !important; }

/* כפתורי נושא: צבע טקסט מפורש (ב-Safari באייפון כפתור בלי צבע מוצג בכחול) */
.topic { color: var(--ink); }

/* אפליקציה (אייפון/אנדרואיד): המכשיר מוסיף שוליים משלו, אז הדף ממלא את האזור המודפס בלבד */
html.in-app.printing .sheet { width: 730px !important; min-height: 0 !important; height: 985px; overflow: hidden; padding: 9mm 9mm 7mm !important; }
@media print {
  html.in-app .sheet { width: auto !important; min-height: 0 !important; height: 985px; overflow: hidden; padding: 9mm 9mm 7mm !important; }
}

/* טלפון: נוסחה לא נשברת באמצע (בשבירה היא נקראת הפוך) */
.help bdi, .help-ex bdi { white-space: nowrap; }
@media screen and (max-width: 700px) {
  .sheet .ex { font-size: 17px; }
  .ex:not(.ex-diagram):not(.ex-rtl) .ex-body { white-space: nowrap; }
}
