:root { --ink: #1b1340; --muted: #4a4466; --bg: #f6f3ff; --card: #fff; --pri: #5b3fd6; --pri-d: #4429b8; --ok: #0e7050; --okbg: #e3f7ee; --bad: #b3261e; --badbg: #fdecea; --line: #ddd6f5; --gold: #f4b400; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Segoe UI", "Arial Hebrew", Arial, "Noto Sans Hebrew", sans-serif; font-size: 18px; line-height: 1.55; color: var(--ink); background: var(--bg); }
.skip { position: absolute; inset-inline-start: -999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { inset-inline-start: .5rem; }
.top { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: .6rem 1rem; background: var(--ink); color: #fff; }
.brand { font-weight: 700; font-size: 1.05rem; margin: 0; line-height: 1.3; }
.who { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.top .btn.ghost { color: #fff; border-color: #ffffff88; background: #1b1340; }
.wrap { max-width: 860px; margin: 0 auto; padding: 1rem; outline: none; }
.twrap { max-width: 1200px; }
.card { background: var(--card); border-radius: 18px; padding: 1.25rem 1.25rem 1.5rem; margin: 0 0 1rem; box-shadow: 0 2px 10px #2a1a7014; border: 1px solid var(--line); }
.card.narrow { max-width: 460px; margin: 2rem auto; }
.hero { text-align: center; }
h1, .h1 { font-size: 1.7rem; margin: .2rem 0 .6rem; line-height: 1.25; }
h2 { font-size: 1.3rem; margin: .2rem 0 .7rem; }
.lead { font-size: 1.1rem; color: var(--muted); margin: .2rem 0 1rem; }
.note { color: var(--muted); font-size: .95rem; }
.big-emoji { font-size: 3.4rem; line-height: 1; margin: .3rem 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .55rem 1.1rem; border-radius: 12px; border: 2px solid var(--pri); background: #fff; color: var(--pri-d); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { background: #efeaff; }
.btn.primary { background: var(--pri); color: #fff; }
.btn.primary:hover { background: var(--pri-d); }
.btn.huge { font-size: 1.3rem; padding: .8rem 2rem; margin-top: .8rem; min-width: 12rem; }
.btn.ghost { border-color: var(--line); color: var(--ink); }
.btn.sm { min-height: 36px; padding: .25rem .7rem; font-size: .9rem; }
.btn.danger { border-color: var(--bad); color: var(--bad); margin-top: 1rem; }
.btn:disabled { opacity: .6; cursor: wait; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.name-form { display: grid; gap: .6rem; max-width: 460px; margin: 0 auto; text-align: start; }
.lbl { font-weight: 700; }
.big-input { font: inherit; font-size: 1.5rem; padding: .7rem .9rem; border: 2px solid var(--line); border-radius: 14px; width: 100%; }
.big-input:focus { border-color: var(--pri); }
.txt, .num-input { font: inherit; padding: .5rem .7rem; border: 2px solid var(--line); border-radius: 12px; min-height: 44px; }
.num-input { width: 9rem; text-align: center; font-size: 1.3rem; }
.num-input.big { width: 11rem; font-size: 2rem; letter-spacing: .2rem; }
.err { color: var(--bad); font-weight: 700; min-height: 1.4em; margin: .3rem 0; }
.digits { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin: .5rem 0 1.2rem; direction: ltr; }
.dbox { width: 4rem; height: 4.6rem; border-radius: 14px; border: 3px dashed var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; background: #faf8ff; }
.dbox.got { border: 3px solid var(--ok); background: var(--okbg); }
.dl { font-size: .85rem; color: var(--muted); font-weight: 700; }
.dv { font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.quiz-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.quiz { display: flex; align-items: center; gap: .8rem; padding: .8rem; border-radius: 14px; border: 2px solid var(--line); background: #fff; }
.quiz.done { background: var(--okbg); border-color: #9fdcc4; }
.quiz.locked { opacity: .7; background: #f3f1f8; }
.qicon { font-size: 1.8rem; width: 2.4rem; text-align: center; flex: none; }
.qtext { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.qdesc { color: var(--muted); font-size: .92rem; }
.qright { flex: none; }
.pill { display: inline-block; padding: .3rem .8rem; border-radius: 99px; background: #eee9fb; font-weight: 700; font-size: .95rem; }
.pill.ok { background: var(--ok); color: #fff; font-size: 1.05rem; }
.qtop { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.qtitle { font-weight: 700; color: var(--muted); }
.bar { height: 10px; border-radius: 99px; background: #ece7fb; margin: .8rem 0 .3rem; overflow: hidden; }
.fill { height: 100%; background: linear-gradient(90deg, var(--pri), #9b7bff); border-radius: 99px; transition: width .4s; }
.qcount { color: var(--muted); margin: 0 0 .6rem; font-size: .95rem; }
.qtext-big { font-size: 1.3rem; font-weight: 600; margin: .4rem 0 .8rem; }
bdi.m { font-family: "Cambria Math", "Segoe UI", Arial, sans-serif; white-space: nowrap; font-weight: 700; color: #2b1a8f; }
.opt bdi.m, .explain bdi.m { color: inherit; }
bdi.m.long { white-space: normal; overflow-wrap: anywhere; }
.fig { display: block; width: 100%; max-width: 380px; height: auto; margin: .3rem auto 1rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; direction: ltr; }
.fig .g { stroke: #d9d3ef; stroke-width: 1; } .fig .g0 { stroke: #eeebf8; stroke-width: 1; }
.fig .ax { stroke: #3a3360; stroke-width: 1.8; } .fig .axh { fill: #3a3360; }
.fig .axl { font: italic 700 13px Arial, sans-serif; fill: #3a3360; }
.fig .tick { font: 12px Arial, sans-serif; fill: #5b5577; text-anchor: middle; } .fig .tick.r { text-anchor: end; }
.fig .sg { stroke: var(--pri); stroke-width: 2.6; stroke-linecap: round; } .fig .ln { stroke: #d9480f; stroke-width: 2; stroke-dasharray: 6 4; }
.fig .pt { fill: #d9480f; stroke: #fff; stroke-width: 1.5; } .fig .pl { font: 700 15px Arial, sans-serif; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.opt { min-height: 58px; padding: .6rem .8rem; border-radius: 14px; border: 2px solid var(--line); background: #fff; font: inherit; font-size: 1.15rem; cursor: pointer; color: var(--ink); }
.opt:hover { border-color: var(--pri); background: #f4f0ff; }
.opt.good { border-color: var(--ok); background: var(--okbg); }
.numf { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; justify-content: center; }
.okmsg { color: var(--ok); font-weight: 800; font-size: 1.3rem; text-align: center; margin: .8rem 0 0; }
.explain { background: #fff8e6; border: 2px solid #f1d38a; border-radius: 16px; padding: 1rem 1.1rem; margin: .6rem 0 1rem; }
.explain h2 { color: #8a5a00; }
.explain p { margin: .35rem 0; font-size: 1.08rem; }
.explain .shown { font-size: 1.15rem; margin-top: .7rem; }
.twin-note { font-weight: 700; color: var(--pri-d); }
.tag { display: inline-block; background: #fff1c2; color: #6d4b00; border-radius: 99px; padding: .15rem .8rem; font-weight: 700; font-size: .9rem; margin: 0; }
.digit-big { font-size: 2.2rem; font-weight: 700; margin: .6rem 0; }
.digit-big strong { display: inline-block; font-size: 5rem; line-height: 1; color: var(--pri); background: #efeaff; border-radius: 20px; padding: .3rem 1.4rem; margin-inline-start: .3rem; vertical-align: middle; }
.formula { font-size: 1.5rem; text-align: center; background: #f4f0ff; border-radius: 14px; padding: .8rem; margin: .5rem 0; overflow-x: auto; }
.code-big { font-size: 4.5rem; font-weight: 800; letter-spacing: .3rem; color: var(--ok); margin: .3rem 0 1rem; }
.win { background: linear-gradient(180deg, #fff, #eafbf3); }
.flash { position: fixed; bottom: 1rem; inset-inline-start: 50%; transform: translateX(50%); background: var(--ink); color: #fff; padding: .6rem 1.2rem; border-radius: 12px; z-index: 5; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: .6rem 0; }
.chk { display: block; margin: .6rem 0; }
.scroll { overflow-x: auto; margin: .6rem 0; }
.tbl { border-collapse: collapse; width: 100%; font-size: .95rem; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: .45rem .5rem; text-align: start; vertical-align: top; }
.tbl th { background: #f4f0ff; font-size: .88rem; }
.tbl .c { text-align: center; } .tbl .big-d { font-size: 1.4rem; font-weight: 800; color: var(--pri); }
.tbl.small { max-width: 520px; }
.tbl .sub { display: block; color: var(--muted); font-size: .8rem; }
.code-mid { font-size: 1.6rem; color: var(--pri); }
.ord { padding-inline-start: 1.4rem; } .ord li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; } .ord li label { flex: 1; } .ord li.off label { color: #5e5878; text-decoration: line-through; }
.ord input[type=checkbox], .chk input { width: 22px; height: 22px; }
.show { background: #fff; }
.showwrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2vh 2vw; }
.showwrap h1 { font-size: clamp(2rem, 5vw, 4rem); }
.showlead { font-size: clamp(1.2rem, 2.6vw, 2.2rem); color: var(--muted); margin: .4rem 0; }
.showurl { font-size: clamp(1.5rem, 7.4vw, 8rem); font-weight: 800; letter-spacing: .02em; color: var(--pri-d); margin: .2rem 0 1rem; line-height: 1.1; overflow-wrap: anywhere; font-family: Arial, sans-serif; }
.qrbox svg { width: min(40vh, 70vw); height: auto; display: block; margin: 0 auto; }
@media (max-width: 560px) {
  body { font-size: 17px; }
  .opts { grid-template-columns: 1fr; }
  .quiz { flex-wrap: wrap; } .qright { width: 100%; } .qright .btn { width: 100%; }
  .digit-big strong { font-size: 4rem; } .code-big { font-size: 3.4rem; }
  .formula { font-size: 1.15rem; }
}
.foot { max-width: 860px; margin: 1rem auto 2rem; padding: 0 1rem; color: var(--muted); font-size: .85rem; text-align: center; }
.gwrap { margin: .4rem 0; }
.desmos { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.gform { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; justify-content: center; margin-top: .6rem; }
.gform .lbl { width: 100%; text-align: center; margin: 0; }
.grow { display: flex; gap: .8rem; }
.gin { display: inline-flex; align-items: center; gap: .3rem; font-weight: 700; }
.num-input.sm { width: 6rem; font-size: 1.15rem; }
@media (max-width: 560px) { .desmos { height: 340px; } }

.fig .dsh { stroke: #c74440; stroke-width: 1.8; stroke-dasharray: 5 4; } .fig .axl.r { text-anchor: end; }
.hintrow { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-start; margin: .2rem 0 .6rem; }
.btn.hintbtn { background: #fff7d6; color: #6b4e00; border: 2px solid #f1d38a; font-size: 1rem; padding: .45rem .9rem; }
.hintbox { background: #fffbe9; border: 2px dashed #f1d38a; border-radius: 14px; padding: .7rem .9rem; margin: .2rem 0 1rem; }
.hintbox .hint-title { font-weight: 700; color: #8a5a00; margin: 0 0 .3rem; }
.hintbox p { margin: .25rem 0; }
.hint-desmos { height: 320px; margin-top: .5rem; }

/* classes + personal codes (Nov 10) */
.cls-pick { margin: .2rem 0 .8rem; }
.cls-row { display: flex; gap: .8rem; flex-wrap: wrap; }
.btn.cls-btn { flex: 1 1 12rem; min-height: 4.6rem; padding: 1rem 1.2rem; font-size: 1.35rem; font-weight: 700; background: #fff; color: var(--ink); border: 3px solid var(--line); }
.btn.cls-btn[aria-pressed="true"] { background: var(--pri); color: #fff; border-color: var(--pri-d); }
.btn.cls-btn[aria-pressed="true"]::before { content: "✓ "; }
.code-input { max-width: 9rem; letter-spacing: .4rem; text-align: center; }
.switch-mode { margin-top: 1rem; }
.hero .btn.ghost.switch-mode { color: var(--pri-d); background: transparent; border-color: var(--pri); }
.my-code { font-size: .85rem; background: #ffffff22; border-radius: .4rem; padding: .05rem .4rem; white-space: nowrap; }
.codes-tbl td.code { font-family: ui-monospace, monospace; font-size: 1.15rem; letter-spacing: .15rem; direction: ltr; text-align: center; }
@media print {
  body.print-codes .top, body.print-codes .flash, body.print-codes .foot, body.print-codes .skip, body.print-codes #tmain > section:not(.codes) { display: none !important; }
  body.print-codes .codes .row, body.print-codes .codes .note, body.print-codes .codes button, body.print-codes .codes a { display: none !important; }
  body.print-codes .codes { box-shadow: none; border: 0; }
  body.print-codes .codes-tbl td, body.print-codes .codes-tbl th { border: 1px solid #000; padding: .35rem .6rem; }
}

/* 📐 free sketch pad (Nov 10) */
.btn.sketchbtn { background: #eaf2fc; color: #1d4f8a; border: 2px solid #9fc0e8; font-size: 1rem; padding: .45rem .9rem; }
.sketchpanel { background: #f6f9fe; border: 2px solid #c9dbf3; border-radius: 14px; padding: .6rem; margin: .2rem 0 1rem; }
.sketchpanel .note { margin: .3rem .2rem; }
.sketch-desmos { height: 460px; }
.sketch-tip { font-size: .9rem; }
@media (max-width: 560px) { .sketch-desmos { height: 380px; } .sketchpanel { padding: .35rem; margin-inline: -.4rem; } }
.numkeys { display: inline-flex; gap: .35rem; }
.btn.numkey { min-width: 2.8rem; padding: .4rem .6rem; font-size: 1.25rem; font-weight: 700; background: #fff; color: var(--ink); border: 2px solid var(--line); }
.guest-banner { margin: .4rem auto 0; max-width: 860px; text-align: center; background: #fff1d6; color: #7a4b00; border: 2px solid #f1c27a; border-radius: 10px; padding: .3rem .7rem; font-weight: 700; }
.guest-note { background: #fff1d6; color: #7a4b00; border-radius: 10px; padding: .4rem .7rem; font-weight: 700; }
.btn.guest-btn { margin-top: .6rem; }

/* teacher: questions per quiz (skip list) */
.qskip { border: 1px solid #ddd8ee; border-radius: 10px; padding: .4rem .7rem; margin: .5rem 0; }
.qskip summary { cursor: pointer; font-weight: 600; padding: .25rem 0; }
.qlist { list-style: none; padding: 0; margin: .4rem 0 .6rem; }
.qlist li { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; }
.qlist li label { flex: 1; }
.qlist li.off label { color: #5e5878; text-decoration: line-through; }
.qlist input[type=checkbox] { width: 22px; height: 22px; flex: none; }

.prompt-card{margin-top:14px}
.prompt-text{white-space:pre-wrap;word-break:break-word;background:#f6f4fb;border:1px solid #ddd6ee;border-radius:10px;padding:12px;font:inherit;font-size:.92rem;line-height:1.55;max-height:340px;overflow:auto;text-align:right}
