/* ===== עיצוב האתר =====
   כל הצבעים והגדלים מרוכזים כאן למעלה כדי שיהיה קל לשנות עיצוב. */
:root {
  --bg: #fbf7ef;
  --ink: #1f2a44;
  --muted: #55607a;
  --primary: #2457c5;
  --primary-dark: #17399a;
  --primary-soft: #e6eefc;
  --gold: #f2b134;
  --gold-soft: #fff4d6;
  --green: #167a4f;
  --green-soft: #def5e8;
  --red: #b3261e;
  --red-soft: #fde7e5;
  --card: #ffffff;
  --line: #e1dccd;
  --radius: 18px;
  --shadow: 0 4px 14px rgba(31, 42, 68, .09);
  --font: "Heebo", "Segoe UI", "Arial Hebrew", Arial, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 18px; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.8; }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
a { color: var(--primary-dark); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; right: 8px; top: -60px; background: #000; color: #fff; padding: 10px 16px; z-index: 100; border-radius: 8px; }
.skip:focus { top: 8px; }
main { padding-top: 22px; padding-bottom: 50px; min-height: 60vh; outline: none; }

.brand-bar { background: linear-gradient(90deg, var(--gold), #ffd36e); color: #3a2a00; text-align: center; font-weight: 800; font-size: 1.25rem; padding: 10px 12px; }
.site-header { background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.header-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; padding-top: 8px; padding-bottom: 8px; }
.logo { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.15rem; }
.menu-btn { display: none; background: #fff; color: var(--primary-dark); border: 0; border-radius: 12px; padding: 8px 14px; font: inherit; font-weight: 700; cursor: pointer; min-height: 44px; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a { color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: .95rem; }
.nav a:hover, .nav a.active { background: rgba(255,255,255,.22); }
.nav a.active { background: #fff; color: var(--primary-dark); }
@media (max-width: 860px) {
  .menu-btn { display: inline-block; }
  .nav { display: none; width: 100%; flex-direction: column; padding-bottom: 8px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; font-size: 1.05rem; border-radius: 12px; }
}

h1, h2, h3, h4 { line-height: 1.35; }
h1 { font-size: 2rem; margin: .3em 0 .4em; }
h2 { font-size: 1.5rem; margin: 1.3em 0 .5em; color: var(--primary-dark); }
h3 { font-size: 1.2rem; margin: 1.1em 0 .3em; }
.prose h1 { font-size: 1.6rem; background: var(--primary-soft); padding: 8px 16px; border-radius: 14px; border-right: 8px solid var(--primary); margin-top: 1.6em; }
.prose h1:first-child { margin-top: 0; }
.prose h2 { font-size: 1.3rem; }
.prose h3 { color: var(--ink); border-bottom: 2px dotted var(--gold); display: inline-block; }
.prose p { margin: .6em 0; }
.prose ul, .prose ol { padding-right: 1.4em; margin: .6em 0; }
.prose li { margin: .35em 0; }
.prose mark { background: var(--gold-soft); box-shadow: inset 0 -.45em 0 var(--gold-soft); padding: 0 3px; border-radius: 4px; color: inherit; }
.prose strong { color: var(--primary-dark); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin: 16px 0; border: 1px solid var(--line); }
.hero { background: linear-gradient(135deg, #2457c5, #4a7be0); color: #fff; border-radius: 26px; padding: 30px 24px; text-align: center; box-shadow: var(--shadow); }
.hero h1 { margin: 0 0 .3em; font-size: 2.3rem; }
.hero p { margin: .3em auto; max-width: 700px; font-size: 1.1rem; }
.hero .sub { font-size: 1.3rem; font-weight: 700; color: #ffe9ad; }
.announce { background: var(--gold-soft); border: 2px solid var(--gold); border-radius: 16px; padding: 12px 18px; margin: 16px 0; font-weight: 600; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 18px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 8px 22px; border-radius: 14px; border: 2px solid var(--primary); background: var(--primary); color: #fff; font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; transition: transform .12s, background .12s; }
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn.alt { background: #fff; color: var(--primary-dark); }
.btn.alt:hover { background: var(--primary-soft); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #3a2a00; }
.btn.gold:hover { background: #ffc552; }
.btn.good { background: var(--green); border-color: var(--green); }
.btn.bad { background: var(--red); border-color: var(--red); }
.btn.small { min-height: 40px; padding: 4px 14px; font-size: .92rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.hero .btn.alt { border-color: #fff; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin: 14px 0; }
.tile { display: block; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .12s, border-color .12s; position: relative; }
.tile:hover { transform: translateY(-3px); border-color: var(--primary); }
.tile h3 { margin: 0 0 4px; font-size: 1.2rem; color: var(--primary-dark); }
.tile p { margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.5; }
.tile .emoji { font-size: 1.8rem; display: block; }
.tile.done { border-color: var(--green); background: #f3fbf6; }
.tile.done::after { content: "✔ נלמד"; position: absolute; left: 12px; top: 12px; background: var(--green); color: #fff; font-size: .8rem; font-weight: 700; padding: 1px 10px; border-radius: 999px; }
.tile.akiva { background: linear-gradient(135deg, #fff4d6, #ffe6a8); border-color: var(--gold); }

.progress { background: #e8e4d8; border-radius: 999px; height: 22px; overflow: hidden; margin: 8px 0; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #35b57c); border-radius: 999px; transition: width .4s; }
.pct { font-size: 1.6rem; font-weight: 800; color: var(--green); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.stat { background: var(--primary-soft); border-radius: 14px; padding: 8px 12px; text-align: center; }
.stat b { display: block; font-size: 1.3rem; color: var(--primary-dark); }

/* תוויות מקור וקופסאות */
.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: 0 10px; border-radius: 999px; vertical-align: middle; margin: 0 2px; line-height: 1.7; white-space: nowrap; }
.tag-mikra { background: #e8f0ff; color: #19408f; }
.tag-class { background: var(--green-soft); color: #0f5a39; }
.tag-rashi { background: #f3e6ff; color: #5a2290; }
.tag-general { background: #eee; color: #444; }
.quote { border-right: 6px solid var(--gold); background: var(--gold-soft); padding: 10px 16px; margin: 10px 0; border-radius: 12px; font-weight: 600; }
.note { border-right: 6px solid #8a54d6; background: #f6efff; padding: 10px 16px; margin: 12px 0; border-radius: 12px; }
.qbox { border-right: 6px solid var(--primary); background: var(--primary-soft); padding: 10px 16px; margin: 12px 0; border-radius: 12px; font-weight: 700; }

/* טבלאות */
.tbl-wrap { overflow-x: auto; margin: 14px 0; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.prose table { border-collapse: collapse; width: 100%; font-size: .98rem; }
.prose th { background: var(--primary); color: #fff; padding: 10px 12px; text-align: right; }
.prose td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.prose tr:nth-child(even) td { background: #faf8f2; }
@media (max-width: 640px) {
  .prose table, .prose tbody, .prose tr, .prose td { display: block; width: 100%; }
  .prose thead { display: none; }
  .prose tr { border: 1px solid var(--line); border-radius: 14px; margin: 10px 0; overflow: hidden; background: #fff; }
  .prose td { border-top: 0; border-bottom: 1px dashed var(--line); background: #fff !important; padding: 8px 12px; }
  .prose td:last-child { border-bottom: 0; }
  .prose td::before { content: attr(data-label); display: block; font-size: .8rem; font-weight: 800; color: var(--primary); }
  .tbl-wrap { border: 0; background: transparent; overflow: visible; }
}

/* ניווט פרקים */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tab { min-height: 44px; padding: 6px 18px; border-radius: 999px; border: 2px solid var(--primary); background: #fff; color: var(--primary-dark); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.tab:hover { background: var(--primary-soft); }
.tab.active { background: var(--primary); color: #fff; }
.tab.done::after { content: " ✔"; }
.pager { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 22px; }

/* שאלות */
.q-item { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); margin: 12px 0; overflow: hidden; }
.q-item.know { border-color: var(--green); }
.q-item.practice { border-color: var(--red); }
.q-head { padding: 14px 18px; display: flex; gap: 12px; align-items: flex-start; }
.q-num { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 800; display: grid; place-items: center; }
.q-text { font-weight: 700; font-size: 1.08rem; flex: 1; }
.q-body { padding: 0 18px 16px; }
.q-ref { color: var(--muted); font-size: .9rem; }
.q-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.answer { background: #f7faff; border: 1px solid #cddcf7; border-radius: 14px; padding: 8px 16px; margin-top: 10px; }
.badge { display: inline-block; padding: 0 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; }
.badge.know { background: var(--green-soft); color: #0f5a39; }
.badge.practice { background: var(--red-soft); color: #7e1a14; }
textarea, input[type=text], input[type=password], select { width: 100%; font: inherit; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
textarea:focus, input:focus, select:focus { border-color: var(--primary); outline: none; }
label { font-weight: 700; display: block; margin: 12px 0 4px; }

/* כרטיסיות */
.flash { perspective: 900px; margin: 16px auto; max-width: 560px; }
.flash button { all: unset; display: block; width: 100%; cursor: pointer; }
.flash .face { min-height: 220px; border-radius: 22px; display: grid; place-items: center; text-align: center; padding: 24px; font-size: 1.4rem; font-weight: 700; box-shadow: var(--shadow); border: 3px solid var(--primary); background: #fff; }
.flash .face.back { background: var(--green-soft); border-color: var(--green); }
.flash small { display: block; color: var(--muted); font-weight: 600; font-size: .9rem; margin-bottom: 8px; }

/* חידון */
.opt { display: block; width: 100%; text-align: right; font: inherit; font-weight: 600; padding: 12px 16px; margin: 9px 0; border-radius: 14px; border: 2px solid var(--line); background: #fff; cursor: pointer; min-height: 52px; color: var(--ink); }
.opt:hover:not([disabled]) { border-color: var(--primary); background: var(--primary-soft); }
.opt.right { border-color: var(--green); background: var(--green-soft); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt[disabled] { cursor: default; }
.feedback { padding: 10px 16px; border-radius: 14px; margin: 10px 0; font-weight: 600; }
.feedback.ok { background: var(--green-soft); color: #0f5a39; }
.feedback.no { background: var(--red-soft); color: #7e1a14; }
.qcount { color: var(--muted); font-weight: 700; }

/* סרטונים */
.video { border: 2px dashed var(--line); border-radius: var(--radius); padding: 14px 18px; background: #fff; }
.video.empty h3 { color: var(--muted); }
.video .ph { color: var(--muted); font-style: italic; }

/* צ'אט */
.chat { display: flex; flex-direction: column; gap: 10px; background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; min-height: 320px; max-height: 60vh; overflow-y: auto; }
.msg { max-width: 88%; padding: 10px 16px; border-radius: 18px; white-space: pre-wrap; line-height: 1.7; }
.msg.user { align-self: flex-start; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-end; background: var(--gold-soft); border-bottom-left-radius: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { font: inherit; font-weight: 600; font-size: .92rem; background: var(--primary-soft); border: 1px solid #bcd0f5; color: var(--primary-dark); border-radius: 999px; padding: 4px 14px; cursor: pointer; min-height: 36px; }
.chip:hover { background: #d3e2fb; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; }
.chat-form input { flex: 1; }
.setup-box { background: var(--red-soft); border: 2px solid var(--red); border-radius: var(--radius); padding: 14px 18px; }

/* ניהול */
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.admin-item { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 6px 16px 14px; margin: 12px 0; }
.admin-item textarea.big { min-height: 300px; font-family: ui-monospace, Consolas, monospace; font-size: .95rem; line-height: 1.6; direction: rtl; }
.toast { position: fixed; bottom: 20px; right: 50%; transform: translateX(50%); background: var(--ink); color: #fff; padding: 12px 24px; border-radius: 14px; font-weight: 700; z-index: 99; box-shadow: var(--shadow); }
.toast.err { background: var(--red); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.site-footer { background: #1f2a44; color: #dfe5f5; text-align: center; padding: 18px 0; font-size: .95rem; }
.site-footer p { margin: 4px 0; }
.site-footer a { color: #aeb9d6; }
.loading { text-align: center; color: var(--muted); padding: 40px; }

@media (max-width: 560px) {
  html { font-size: 17px; }
  .hero h1 { font-size: 1.7rem; }
  .brand-bar { font-size: 1.05rem; }
  .msg { max-width: 96%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
@media print { .site-header, .brand-bar, .site-footer, .btn-row, .pager, .tabs { display: none; } }

/* עזרים (במקום style מוטבע, בגלל מדיניות האבטחה) */
.m0 { margin: 0; }
.mt0 { margin-top: 0; }
.jstart { justify-content: flex-start; }
.tight { margin: 0 0 12px; }
.tcenter { text-align: center; }
[hidden] { display: none !important; }
