@import url("https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap");

:root {
  --bg: #FAF8F5;
  --navy: #161616;
  --blue: #6240D1;
  --sky: #F6F4FC;
  --side: #F4F2EE;
  --tint: #F4F2EE;
  --ink: #161616;
  --ink-2: #4A4742;
  --muted: #77736B;
  --rule: #E6E1D9;
  --rule-strong: #161616;
  --focus: #6240D1;
  --lane: #B9B2A6;
  --stamp: #6240D1;

  /* ERD building blocks - same colours everywhere on the site */
  --entity: #1F5FA8;
  --entity-bg: #E4EDF8;
  --attr: #2B7A4B;
  --attr-bg: #E3F2E8;
  --rel: #8E3B87;
  --rel-bg: #F3E5F1;
  /* schema tables (04): white header with a violet stripe, key lavender, foreign keys pink */
  --pk: #161616;
  --pk-bg: #EFEBFB;
  --fk: #B0345A;
  --fk-bg: #FBE7EE;

  --ok: #2B7A4B;
  --warn: #9A5B00;
  --warn-bg: #FFF5E0;

  --side-w: 272px;
  --font: "Heebo", "Noto Sans Hebrew", system-ui, sans-serif;
  --hi: #D9F24A;
  --line: #E6E1D9;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  direction: rtl;
  background: var(--bg);
  color: var(--ink);
  font: 16.5px/1.7 var(--font);
}

.ltr { direction: ltr; unicode-bidi: isolate; }
code, .mono { font-family: var(--font-mono); font-size: .9em; direction: ltr; unicode-bidi: isolate; }
a { color: var(--focus); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); letter-spacing: -.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.08rem; }

/* ---------- buttons and fields ---------- */
.btn {
  font: 600 .92rem var(--font); padding: 7px 14px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--navy); background: var(--navy); color: #fff; line-height: 1.4;
}
.btn:hover { background: var(--blue); border-color: var(--blue); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--blue); color: var(--blue); background: transparent; }
.btn.small { padding: 3px 10px; font-size: .84rem; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, button:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

textarea, input[type="text"] {
  width: 100%; font: inherit; color: inherit; border: 1px solid var(--rule); border-radius: 4px;
  padding: 9px 11px; background: #fff;
}
textarea:focus, input[type="text"]:focus { border-color: var(--blue); outline: none; }
textarea { min-height: 120px; resize: vertical; }
.saved-hint { font-size: .8rem; color: var(--muted); }
.field-label { display: block; font-weight: 600; margin: 18px 0 6px; }

/* ---------- simple pages (home, standalone cheat sheet) ---------- */
.topbar { border-bottom: 1px solid var(--rule); }
.topbar .wrap { display: flex; align-items: center; gap: 24px; min-height: 52px; flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.topbar nav { display: flex; gap: 18px; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; color: var(--muted); font-weight: 500; font-size: .95rem; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { color: var(--ink); }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.page-head { padding: 44px 0 12px; }
.page-head .kicker { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.page-head p { color: var(--ink-2); max-width: 64ch; margin: 0; }
.section-title { margin: 40px 0 14px; font-size: 1.15rem; padding-bottom: 8px; border-bottom: 1px solid var(--rule-strong); }

/* home: lesson cards + reference cards */
.home-band { background: var(--navy); color: #fff; position: relative; overflow: hidden; }
.home-head { padding: 44px 16px; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 24px; }
.home-head h1 { color: #fff; }
.home-head p { color: #C9D7EA; max-width: 62ch; margin: 0; grid-column: 1 / -1; }
.group-label { font-size: .8rem; font-weight: 600; color: var(--muted); margin: 40px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cards-note { margin: 12px 0 0; font-size: .85rem; color: var(--muted); }
.card {
  display: flex; flex-direction: column; gap: 6px; min-height: 180px; padding: 20px;
  border: 1px solid var(--rule); border-radius: 8px; background: #fff; color: inherit; text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
a.card:hover { border-color: var(--blue); box-shadow: 0 10px 22px -12px rgba(11, 37, 69, .5); transform: translateY(-2px); }
/* home: the cards rise in once, one after another (backwards, so hover can still lift them) */
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } }
.home .card { animation: card-in .35s ease-out backwards; }
.home .card:nth-child(2) { animation-delay: .05s; } .home .card:nth-child(3) { animation-delay: .1s; }
.home .card:nth-child(4) { animation-delay: .15s; } .home .card:nth-child(5) { animation-delay: .2s; }
.home .card:nth-child(6) { animation-delay: .25s; }
@media (prefers-reduced-motion: reduce) { .home .card { animation: none; } a.card:hover { transform: none; } }
.card-icon { direction: ltr; box-sizing: content-box; width: 22px; height: 22px; padding: 9px; margin-bottom: 10px; border-radius: 10px; background: var(--sky); color: var(--blue); fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.card.soon .card-icon { background: var(--rule); color: var(--muted); }
.card h3 { margin: 0; font-size: 1.05rem; }
.card p { margin: 0; color: var(--ink-2); font-size: .92rem; line-height: 1.55; }
.card .meta { margin-top: auto; padding-top: 10px; font-size: .8rem; color: var(--muted); }
.card.soon { color: var(--muted); background: var(--tint); border-style: dashed; }
.card.soon h3, .card.soon p { color: var(--muted); }

footer.site-foot { color: var(--muted); font-size: .82rem; padding: 48px 0 32px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; }

/* ---------- lesson page: top bar, step pager, side column, bottom bar ---------- */
.lesson-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.lesson-top { display: flex; align-items: center; gap: 22px; min-height: 48px; padding: 0 20px; background: var(--navy); color: #fff; flex: none; }
.back-home { color: #BFD3EE; text-decoration: none; font-size: .88rem; }
.back-home:hover { color: #fff; }
.lesson-name { font-weight: 700; }

.pager { position: relative; flex: none; background: var(--sky); border-bottom: 1px solid var(--rule); padding: 28px 40px 26px; }
.route { position: relative; display: flex; justify-content: space-between; max-width: 760px; margin: 0 auto; }
.route::before { content: ""; position: absolute; top: 15px; left: 15px; right: 15px; border-top: 2px dashed #9DB7D8; }
.route .done-line { position: absolute; top: 14px; right: 15px; height: 4px; width: 0; background: var(--blue); border-radius: 2px; transition: width .6s ease; }
.stop {
  position: relative; z-index: 1; width: 32px; height: 32px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid #9DB7D8; background: #fff; color: var(--muted); font: 600 .85rem var(--font-mono); cursor: pointer;
}
.stop:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.stop.done { border-color: var(--blue); background: var(--blue); color: #fff; }
.stop[aria-current="step"] { border-color: var(--navy); background: var(--navy); color: #fff; box-shadow: 0 0 0 4px rgba(21, 89, 176, .18); }
.stop:disabled { cursor: not-allowed; }
.stop:disabled:not(.done) { opacity: .55; }
.stop .lbl { position: absolute; top: 36px; white-space: nowrap; font: 500 .72rem var(--font); color: var(--muted); }
.stop[aria-current="step"] .lbl { color: var(--navy); font-weight: 700; }
.hover-plane { position: absolute; top: -18px; right: 0; width: 26px; height: 11px; z-index: 2; color: var(--navy); pointer-events: none;
  transition: right .7s cubic-bezier(.34, 1.56, .64, 1); animation: bob 1.4s ease-in-out infinite; }
/* side view drawn nose-right: mirror it to face the next steps, nose up about 20 degrees */
.hover-plane svg { display: block; width: 26px; height: 11px; transform: scaleX(-1) rotate(-20deg); transform-origin: 50% 60%; }
@keyframes bob { 0%, 100% { margin-top: 0; } 50% { margin-top: -3px; } }

/* the corner: a flight lane from the step strip down the empty left margin, and an arrival stamp */
.sky { position: absolute; left: 0; top: 0; width: 380px; height: 480px; pointer-events: none; z-index: 5; }
.sky > svg { display: block; overflow: visible; }
.sky .lane { fill: none; stroke: var(--lane); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 0 9; }
.sky .jet { color: var(--navy); }
.stamp { position: absolute; left: -12px; top: 98px; width: 106px; height: 106px; transform: rotate(-16deg); color: var(--stamp); opacity: .82; mix-blend-mode: multiply; pointer-events: none; }
.stamp svg { display: block; width: 100%; height: 100%; direction: ltr; unicode-bidi: isolate; }
.drawing .sky { display: none; }
@media (max-width: 1439px) { .sky { display: none; } }
@media (prefers-reduced-motion: reduce) { .hover-plane { animation: none; } }

.lesson { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.side { overflow-y: auto; background: var(--side); border-inline-end: 1px solid var(--rule); display: flex; flex-direction: column; }
.side-toggle { align-self: flex-end; margin: 8px 10px 0; border: 0; background: none; cursor: pointer; color: var(--muted); font: 500 .78rem var(--font); padding: 2px 6px; border-radius: 4px; }
.side-toggle:hover { color: var(--ink); background: var(--sky); }
.side-step { padding: 2px 20px 18px; border-bottom: 1px solid var(--rule); }
.side-step .kind { display: inline-block; font-size: .72rem; font-weight: 600; color: #fff; background: var(--blue); border-radius: 3px; padding: 1px 8px; margin-bottom: 8px; }
.side-step .linkish { border: 0; background: none; padding: 0; margin-top: 8px; font: 500 .82rem var(--font); color: var(--blue); text-decoration: underline; cursor: pointer; }
.side-step .kind:empty { display: none; }
.side-step h2 { font-size: 1.2rem; margin: 0 0 4px; }
.side-step p { margin: 0; font-size: .9rem; color: var(--ink-2); line-height: 1.55; }
.side-step .side-now { font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.side-block { padding: 16px 20px; border-bottom: 1px solid var(--rule); }
.side-block h3 { font-size: .74rem; font-weight: 600; color: var(--muted); margin: 0 0 10px; }
.concepts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.concepts li { background: #fff; border: 1px solid var(--rule); border-radius: 6px; padding: 9px 12px; font-size: .85rem; line-height: 1.45; }
.concepts strong { display: block; font-size: .9rem; margin-bottom: 2px; }
.concepts strong::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--entity); margin-inline-end: 7px; vertical-align: middle; }
.concepts span { color: var(--ink-2); }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.files button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--rule); border-radius: 6px; padding: 7px 12px; font: 500 .85rem var(--font); color: var(--ink); cursor: pointer; text-align: start; }
.files button:hover { border-color: var(--blue); }
.files .ext { font: 600 .68rem var(--font-mono); color: var(--ok); border: 1px solid var(--ok); border-radius: 3px; padding: 0 5px; }
.side-tools { display: grid; gap: 6px; }
.tool {
  font: 600 .9rem var(--font); text-align: start; cursor: pointer; padding: 7px 12px; border-radius: 6px;
  border: 1px solid var(--rule); background: #fff; color: var(--ink);
}
.tool:hover { border-color: var(--blue); }
.tool[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.side-foot { margin-top: auto; padding: 16px 20px; display: grid; gap: 6px; font-size: .78rem; color: var(--muted); }
.side-foot .linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; text-align: start; }
.side-foot .linkish:hover, .side-foot a:hover { color: var(--ink); }
.side-foot a { color: var(--muted); }
#backupStatus:empty { display: none; }
#backupStatus .btn { margin-top: 4px; }
.reset-confirm { display: grid; gap: 4px; justify-items: start; color: var(--ink-2); }

/* collapsed: a narrow rail with the expand button and the reference tools */
.side-collapsed { --side-w: 64px; }
.side-collapsed .side-step, .side-collapsed #sideConceptsBlock, .side-collapsed #sideFilesBlock,
.side-collapsed .side-foot, .side-collapsed .side-tools h3 { display: none; }
.side-collapsed .side-toggle { align-self: center; margin: 10px 0 4px; }
.side-collapsed .side-tools { padding: 8px 6px; border: 0; }
.side-collapsed .tool { padding: 6px 2px; text-align: center; font-size: .72rem; }

.main { min-height: 0; display: flex; }
.stages { flex: 1; min-width: 0; overflow-y: auto; padding: 36px 48px 40px; }
.stages > .step { max-width: 780px; }

/* drawing: instructions column + editor */
.drawing .stages { flex: none; width: 400px; padding: 24px 22px 32px; border-inline-end: 1px solid var(--rule); }
.drawing .step h2 { font-size: 1.25rem; }

.lesson-bottom { flex: none; display: flex; align-items: center; gap: 16px; padding: 10px 20px; border-top: 1px solid var(--rule); background: #fff; }
.bottom-now { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.bottom-now strong { font-size: .92rem; }
.bottom-now span { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* sub-step tabs (inside a stage) */
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 22px; border-bottom: 1px solid var(--rule); }
.subnav button {
  display: flex; align-items: center; gap: 7px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; padding: 8px 10px; font: 600 .88rem var(--font); color: var(--ink-2); cursor: pointer;
}
.subnav button:hover:not(:disabled) { color: var(--ink); }
.subnav button[aria-selected="true"] { border-bottom-color: var(--blue); color: var(--navy); }
.subnav button:disabled { color: var(--muted); opacity: .6; cursor: not-allowed; }
.subnav .i { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor; display: inline-flex; align-items: center; justify-content: center; font: 600 .7rem var(--font-mono); }
.subnav .done .i { border-color: var(--blue); color: #fff; background: var(--blue); }
.subnav [aria-selected="true"] .i { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- stage content ---------- */
.step-head { margin-bottom: 18px; }
.step-head .gate { display: block; font-family: var(--font-mono); font-size: .8rem; color: var(--muted); margin-bottom: 2px; }
.step-head h2 { margin: 0; }
.lock-note { color: var(--muted); }
.step.locked > :not(.step-head):not(.lock-note) { display: none; }
.step:not(.locked) > .lock-note { display: none; }

.lead { color: var(--ink-2); margin: 0 0 18px; }
.task { font-weight: 500; margin: 0 0 12px; }

.note { border: 1px solid var(--rule); border-radius: 4px; padding: 12px 16px; margin: 0 0 20px; font-size: .95rem; }
.note > strong:first-child { display: block; margin-bottom: 2px; }

/* a change request from the company, as a message */
.msg { border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; margin: 0 0 22px; background: #fff; box-shadow: 0 6px 18px -14px rgba(11, 37, 69, .5); }
.msg-head { display: flex; gap: 12px; align-items: center; background: var(--sky); padding: 10px 16px; }
.msg .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.msg .who { font-weight: 700; line-height: 1.25; }
.msg .who small { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; }
.msg .flag { margin-inline-start: auto; color: var(--blue); border: 1px solid var(--blue); background: #fff; font-size: .74rem; font-weight: 600; border-radius: 99px; padding: 0 10px; white-space: nowrap; }
.msg-body { padding: 14px 18px; }
.msg-body p { margin: 0; }

.questions { margin: 0 0 12px; padding-inline-start: 1.3em; }
.questions li { margin: 3px 0; }
h3.sub { font-size: .98rem; margin: 26px 0 8px; }

.step-foot { display: flex; flex-direction: column; gap: 10px; margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--rule); }
.criteria { margin: 0; font-size: .9rem; color: var(--muted); }
.criteria strong { color: var(--ink); font-weight: 600; }
.step-foot .btn { align-self: flex-start; }
.snap-note { color: var(--ok); font-weight: 600; font-size: .9rem; margin: 0; }
.snap-note:empty { display: none; }


.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: .95rem; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.checklist input { width: 17px; height: 17px; margin-top: 5px; flex: none; accent-color: var(--ink); }

details { margin: 14px 0; border-top: 1px solid var(--rule); }
details > summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
details.hint > summary { color: var(--muted); }
details.solution { border-top: 2px solid var(--ok); }
details.solution > summary { color: var(--ok); }
details[open] { padding-bottom: 6px; }

/* scenario + highlighter */
.scenario p { margin: 0 0 .9em; }
.hl-toolbar {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px 0; margin-bottom: 8px; border-bottom: 1px solid var(--rule);
}
.hl-toolbar .label { font-size: .85rem; color: var(--muted); margin-inline-end: 4px; }
.hl-btn { font: 600 .86rem var(--font); border-radius: 4px; padding: 3px 11px; cursor: pointer; border: 1px solid; }
.hl-btn[data-kind="entity"] { color: var(--entity); background: var(--entity-bg); border-color: var(--entity); }
.hl-btn[data-kind="attr"] { color: var(--attr); background: var(--attr-bg); border-color: var(--attr); }
.hl-btn[data-kind="rel"] { color: var(--rel); background: var(--rel-bg); border-color: var(--rel); }
.hl-btn[data-kind="clear"] { color: var(--muted); background: #fff; border-color: var(--rule); }
mark.hl { padding: 0 2px; border-radius: 2px; color: inherit; }
mark.hl-entity { background: var(--entity-bg); box-shadow: inset 0 -2px 0 var(--entity); }
mark.hl-attr { background: var(--attr-bg); box-shadow: inset 0 -2px 0 var(--attr); }
mark.hl-rel { background: var(--rel-bg); box-shadow: inset 0 -2px 0 var(--rel); }

/* scenario as company documents */
.docs { display: flex; flex-direction: column; gap: 22px; }
.doc { border: 1px solid var(--rule); border-radius: 8px; background: #fff; box-shadow: 0 1px 0 rgba(11, 37, 69, .04), 0 6px 18px -12px rgba(11, 37, 69, .35); }
.doc-head { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--rule); font-size: .8rem; color: var(--muted); user-select: none; }
.doc-head .t { font-weight: 700; color: var(--navy); font-size: .88rem; }
.doc-head .n { margin-inline-start: auto; font-family: var(--font-mono); direction: ltr; unicode-bidi: isolate; }
.doc-body { padding: 14px 18px; }
.doc-body p { margin: 0; }
.doc-fig { margin-bottom: 12px; user-select: none; }
.memo-fields { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: .85rem; color: var(--muted); margin-bottom: 10px; user-select: none; }
.memo-fields b { color: var(--ink); font-weight: 600; }
.board { background: #0E1B2C; border-radius: 6px; padding: 10px 12px; font-family: var(--font-mono); color: #F3C04A; font-size: .82rem; direction: ltr; }
.board table { width: 100%; border-collapse: collapse; }
.board th { color: #8EA3BF; font-weight: 500; text-align: left; font-size: .72rem; padding: 2px 6px; border-bottom: 1px solid #26384F; }
.board td { padding: 4px 6px; border-bottom: 1px solid #1A2A3F; }
.board .st { color: #7FD8A4; }
.route-card { display: flex; align-items: center; gap: 18px; border: 1px solid var(--rule); border-radius: 8px; padding: 10px 16px; background: linear-gradient(180deg, var(--sky) 0, #fff 70%); direction: ltr; font-family: var(--font-mono); }
.route-card .code { font-size: 1.4rem; font-weight: 600; color: var(--navy); }
.route-card .line { flex: 1; border-top: 2px dashed #9DB7D8; position: relative; }
.route-card .line span { position: absolute; left: 50%; top: -11px; transform: translateX(-50%); background: #fff; padding: 0 6px; color: var(--navy); font-size: .9rem; }
.route-card .meta { font-size: .78rem; color: var(--muted); text-align: right; }
.spec { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 2px 26px; font-size: .8rem; border: 1px solid var(--rule); border-radius: 8px; padding: 10px 16px; background: var(--tint); }
.spec dt { color: var(--muted); }
.spec dd { margin: 0; font-weight: 600; font-family: var(--font-mono); direction: ltr; unicode-bidi: isolate; text-align: right; }
.signs { display: flex; gap: 10px; flex-wrap: wrap; }
.sign { background: #F6C343; color: #1B1B1B; border-radius: 4px; padding: 6px 12px; font-weight: 700; display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.sign .g { font-family: var(--font-mono); background: #1B1B1B; color: #F6C343; border-radius: 3px; padding: 0 7px; direction: ltr; }
.form-card { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; border: 1px solid var(--rule); border-radius: 8px; padding: 12px 16px; font-size: .8rem; color: var(--muted); }
.form-card span { display: block; border-bottom: 1px solid var(--rule); padding-bottom: 12px; }
.form-card .full { grid-column: 1 / -1; border: 0; padding: 0; color: var(--ink-2); }
.pass { display: grid; grid-template-columns: 1fr 160px; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.pass .main-p { padding: 12px 16px; background: linear-gradient(180deg, var(--sky) 0, #fff 60%); }
.pass .stub { border-inline-start: 2px dashed var(--rule); padding: 12px 14px; background: var(--tint); font-size: .8rem; }
.pass .route-big { display: flex; align-items: center; gap: 14px; font-family: var(--font-mono); font-size: 1.4rem; font-weight: 600; color: var(--navy); direction: ltr; justify-content: flex-end; }
.pass .route-big .arrow { font-size: 1rem; color: var(--muted); }
.pass dl { display: grid; grid-template-columns: repeat(4, auto); gap: 0 16px; margin: 8px 0 0; font-size: .78rem; }
.pass dt { color: var(--muted); }
.pass dd { margin: 0; font-weight: 600; }
.pass .empty { color: var(--muted); font-weight: 400; font-style: italic; }
.panel-body .doc-fig, .panel-body .memo-fields { display: none; }
.panel-body .doc { box-shadow: none; margin-bottom: 12px; }

/* intro screen at the start of a stage */
.step.show-intro > :not(.intro):not(.step-meta) { display: none; }
.step:not(.show-intro) > .intro { display: none; }
.intro .eyebrow { font-size: .8rem; font-weight: 600; color: var(--blue); }
.intro h2 { margin-top: .15em; }
.intro .lede { font-size: 1.05rem; max-width: 640px; }
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 22px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.figs figure { margin: 0; padding: 14px 8px; text-align: center; font-size: .85rem; }
.figs figure + figure { border-inline-start: 1px solid var(--rule); }
.figs figcaption strong { display: block; font-size: .9rem; }
.figs figcaption span { color: var(--muted); }
.figs svg { display: block; margin: 0 auto 8px; direction: ltr; max-width: 100%; height: auto; }
.quiz h3 { font-size: 1rem; margin: 26px 0 4px; }
.quiz .q, .classify .q { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.quiz .q > span, .classify .q > span { flex-basis: 100%; }
.opt { font: 500 .85rem var(--font); border: 1px solid var(--rule); background: #fff; border-radius: 99px; padding: 3px 14px; cursor: pointer; color: var(--ink); }
.opt:hover { border-color: var(--blue); }
.opt[aria-pressed="true"] { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.opt.right { border-color: var(--ok); background: #E5F4EC; color: var(--ok); }
.opt.wrong { border-color: #B3261E; background: #FBEAE9; color: #B3261E; }
.start-row { margin-top: 24px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.start-row span { color: var(--muted); font-size: .88rem; }

/* worksheets */
.sheet { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: .93rem; }
.sheet th, .sheet td { border: 1px solid var(--rule); padding: 4px; text-align: center; }
.sheet th { background: var(--tint); font-weight: 600; padding: 7px 4px; }
.sheet input, .sheet select { width: 100%; border: 0; font: inherit; padding: 6px; background: transparent; text-align: center; }
.sheet select { cursor: pointer; }
.sheet .del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; }
.sheet .del:hover { color: var(--ink); }
.sheet-scroll { overflow-x: auto; }
details .sheet td { text-align: start; padding: 6px 8px; }

/* before/after + gallery */
.compare { margin-top: 22px; }
.compare-grid, .gallery { display: grid; grid-template-columns: 1fr; gap: 12px; }
.compare-grid figure, .gallery figure { margin: 0; border: 1px solid var(--rule); border-radius: 4px; padding: 10px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.compare-grid figcaption, .gallery figcaption { font-size: .82rem; color: var(--muted); font-weight: 600; }
.compare-grid img, .gallery img { max-width: 100%; max-height: 360px; display: block; margin: 0 auto; cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(22, 25, 29, .82); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; background: #fff; border-radius: 2px; }

/* draw.io work area */
.work-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.editor-shell { flex: 1; display: flex; flex-direction: column; min-height: 0; background: #fff; }
.editor-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--rule); }
.editor-bar .status { font-size: .8rem; color: var(--muted); margin-inline-start: auto; }
.editor-frame { flex: 1; width: 100%; min-height: 360px; border: 0; display: block; background: #fff; }
.editor-shell.full { position: fixed; inset: 0; z-index: 100; }
.editor-foot { font-size: .78rem; color: var(--muted); padding: 6px 12px; border-top: 1px solid var(--rule); margin: 0; }

/* schema editor */
.schema { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 12px 0; }
.schema-table { border: 1px solid var(--rule); border-radius: 4px; padding: 12px; }
.schema-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.schema-head input { font-weight: 700; max-width: 320px; }
.schema-table .sheet input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--ink); }
.schema-extra { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: .88rem; color: var(--muted); }
.schema-extra input { flex: 1; }
.schema-solution pre { background: var(--tint); border-radius: 4px; padding: 12px; overflow-x: auto; font-family: var(--font-mono); font-size: .84rem; line-height: 1.5; text-align: left; }
.check-results { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 4px; font-size: .93rem; }
.check-results li { padding: 6px 10px; border-radius: 4px; }
.check-results li.warn { background: var(--warn-bg); }
.check-results li.ok { background: var(--attr-bg); color: var(--ok); font-weight: 600; }
.erd-ref img { max-width: 100%; border: 1px solid var(--rule); border-radius: 4px; cursor: zoom-in; display: block; }

/* reference panel (scenario / cheat sheet) */
.panel {
  position: fixed; top: 0; bottom: 0; inset-inline-start: var(--side-w); z-index: 60;
  width: min(460px, calc(100vw - var(--side-w))); background: #fff; border-inline-end: 1px solid var(--rule);
  box-shadow: 0 0 32px rgba(22, 25, 29, .12); display: flex; flex-direction: column;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--rule); }
.panel-head h2 { font-size: 1.05rem; margin: 0; }
.panel-body { flex: 1; overflow-y: auto; padding: 16px 20px; font-size: .95rem; }
.panel-body.frame { padding: 0; overflow: hidden; }
.panel-body iframe { width: 100%; height: 100%; border: 0; }
.panel-body h3 { font-size: .8rem; font-family: var(--font-mono); color: var(--muted); font-weight: 500; margin: 18px 0 6px; }
.panel-body h3:first-child { margin-top: 0; }

/* ---------- cheat sheet ---------- */
.cheat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 28px; }
.cheat { padding: 16px 0; border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; gap: 6px; }
.cheat svg { display: block; width: 100%; height: auto; max-height: 110px; direction: ltr; }
.cheat h3 { margin: 0; }
.cheat p { margin: 0; color: var(--ink-2); font-size: .94rem; }
.cheat .figure { padding: 6px 0; }
.ends { width: 100%; border-collapse: collapse; }
.ends td, .ends th { padding: 10px 12px; border-bottom: 1px solid var(--rule); text-align: start; vertical-align: middle; }
.ends th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.ends svg { width: 150px; height: 40px; direction: ltr; display: block; }
.ends .mono { white-space: nowrap; }

body.embed .topbar, body.embed footer { display: none; }
body.embed .page-head { padding-top: 16px; }
body.embed .page-head .kicker { display: none; }
body.embed h1 { font-size: 1.4rem; }
body.embed .page-head p { font-size: .92rem; }
body.embed .cheat-grid { grid-template-columns: 1fr; }
body.embed .section-title { margin-top: 28px; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .lesson-page { height: auto; overflow: visible; display: block; }
  .lesson-top { gap: 12px; padding: 0 16px; flex-wrap: wrap; }
  .lesson-name { font-size: .92rem; }
  .pager { overflow-x: auto; padding: 26px 16px 24px; }
  .route { min-width: 520px; }
  .pass { grid-template-columns: 1fr; }
  .pass .stub { border-inline-start: 0; border-top: 2px dashed var(--rule); }
  .pass dl { grid-template-columns: repeat(2, auto); }
  .lesson, .side-collapsed .lesson { display: block; }
  .side-toggle, .side-collapsed .side-toggle { display: none; }
  .side-collapsed .side-step, .side-collapsed .side-tools h3 { display: block; }
  .side-collapsed .side-tools { padding: 16px 20px; }
  #sideConceptsBlock, #sideFilesBlock { display: none; }
  .side-foot, .side-collapsed .side-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0 20px 14px; }
  .side-step { padding-top: 16px; }
  .side-tools { display: flex; flex-wrap: wrap; }
  .side-tools h3 { width: 100%; }
  .main, .drawing .main { display: block; }
  .stages, .drawing .stages { width: auto; overflow: visible; padding: 24px 16px; border: 0; }
  .work-area { height: 80vh; padding-bottom: 16px; }
  .lesson-bottom { position: sticky; bottom: 0; padding: 8px 16px; }
  .bottom-now span { display: none; }
  .panel { inset: 0; width: 100%; }
}

@media (min-width: 1200px) {
  .compare-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr 1fr; }
}
@media print {
  .topbar, footer { display: none; }
  body { font-size: 13px; }
  .cheat, .ends { break-inside: avoid; }
}

/* shared relationship table: names only until the cardinality stage */
#relBlock[data-mode="names"] .sheet tr > :nth-child(2),
#relBlock[data-mode="names"] .sheet tr > :nth-child(4) { display: none; }
.drawing .sheet { font-size: .85rem; }
.drawing .sheet input, .drawing .sheet select { padding: 5px 3px; }

/* stage 2: entity builder beside the story */
.stages > .step.wide { max-width: 1180px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.split-story { position: sticky; top: 0; max-height: calc(100vh - 290px); overflow-y: auto; padding-inline-end: 4px; }
.split-story .doc-fig, .split-story .memo-fields { display: none; }
.split-story .hl-toolbar { position: sticky; top: 0; z-index: 1; background: #fff; }

.ebuild h3.sub:first-child { margin-top: 0; }
.pool { display: flex; flex-wrap: wrap; gap: 6px; min-height: 44px; padding: 8px; border: 1px dashed var(--rule); border-radius: 8px; background: var(--tint); }
.pool.over { border-color: var(--blue); background: var(--sky); }
.pool-none { margin: 4px; color: var(--muted); font-size: .9rem; }
.pool-foot { margin: 4px 0 0; min-height: 1em; font-size: .85rem; }
.pool-foot .linkish, .lead .linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--blue); text-decoration: underline; cursor: pointer; }
.wide-stage .sky { display: none; }

.chip { display: inline-flex; align-items: center; border-radius: 6px; font-size: .92rem; cursor: grab; user-select: none; }
.chip.dragging { opacity: .4; }
.chip .chip-t { border: 0; background: none; font: inherit; color: inherit; padding: 3px 4px 3px 9px; cursor: inherit; }
.chip .chip-x { border: 0; background: none; color: var(--muted); font-size: 1rem; line-height: 1; padding: 3px 7px 3px 5px; cursor: pointer; }
.chip .chip-x:hover, .chip .chip-ed:hover { color: var(--ink); }
.chip .chip-ed { border: 0; background: none; color: var(--muted); font-size: .8rem; line-height: 1; padding: 3px 2px; cursor: pointer; opacity: .55; }
.chip:hover .chip-ed, .chip .chip-ed:focus-visible { opacity: 1; }
.chip-edit { font: inherit; font-size: .92rem; padding: 3px 8px; border: 1.5px solid var(--blue); border-radius: 6px; outline: none; background: #fff; }
mark.hl.flash { outline: 2.5px solid var(--navy); outline-offset: 1px; border-radius: 2px; }
.chip.k-entity { background: var(--entity-bg); box-shadow: inset 0 0 0 1.5px var(--entity); }
.chip.k-attr { background: var(--attr-bg); box-shadow: inset 0 0 0 1.5px var(--attr); border-radius: 99px; }
.chip.key .chip-t { text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.chip.picked { outline: 2.5px solid var(--navy); outline-offset: 2px; }
.eattrs .chip.before { box-shadow: inset 0 0 0 1.5px var(--attr), 3px 0 0 0 var(--navy); }

.ecards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.drawing .ecards { grid-template-columns: 1fr; }
.ecard { border: 1.5px solid var(--rule); border-radius: 8px; padding: 8px; background: #fff; min-height: 84px; }
.ecard.over, .has-picked .ecard, .has-picked .pool { border-color: var(--blue); }
.ecard.over { background: var(--sky); }
.ecard-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.ecard-head .ename { font-weight: 700; }
.ecard-head > .chip-x { border: 0; background: none; color: var(--muted); font-size: 1.05rem; cursor: pointer; }
.eattrs { display: flex; flex-wrap: wrap; gap: 5px; }
.ecard-hint { color: var(--muted); font-size: .85rem; }
.ecard.new { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-style: dashed; color: var(--muted); background: var(--tint); }
.ecard.new strong { color: var(--navy); }
.ecard.new span { font-size: .82rem; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } .split-story { position: static; max-height: none; } }

/* stages 3-4: the table beside the story; intros keep the normal width */
.stages > .step.wide.show-intro, .stages > .step.wide.sub-intro { max-width: 780px; }
.split .sheet select { min-width: 0; }

/* entity list / relationship table floating over the editor */
.float-bar { display: none; }
.drawing .float-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.float-title { font-weight: 700; color: var(--navy); }
.drawing #relBlock > .field-label { display: none; }
.drawing .floating { position: fixed; z-index: 90; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); min-width: 240px; min-height: 120px; overflow: auto; resize: both; background: #fff; border: 1px solid var(--rule); border-radius: 10px; padding: 0 12px 12px; box-shadow: 0 10px 30px rgba(22, 32, 46, .18); }
.drawing .floating .float-bar { position: sticky; top: 0; z-index: 2; margin: 0 -12px 8px; padding: 6px 12px; background: var(--tint); border-bottom: 1px solid var(--rule); cursor: move; touch-action: none; user-select: none; }
body:not(.drawing) [data-floatable] { width: auto !important; height: auto !important; }
.moving-float .editor-frame { pointer-events: none; }

/* ready-made diagrams menu in the editor bar */
.tpl { position: relative; }
.tpl-list { position: absolute; top: calc(100% + 4px); inset-inline-start: 0; z-index: 20; display: flex; flex-direction: column; min-width: 220px; padding: 4px; background: #fff; border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 8px 24px rgba(22, 32, 46, .14); }
.tpl-list[hidden] { display: none; }
.tpl-list button { border: 0; background: none; font: inherit; font-size: .88rem; text-align: start; padding: 7px 10px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.tpl-list button:hover { background: var(--sky); }
.editor-bar .status .linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--blue); text-decoration: underline; cursor: pointer; }

/* class demo controls (instructor build) */
.demo-bar { position: fixed; left: 16px; bottom: 76px; z-index: 95; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 8px 12px; background: #fff; border: 1.5px solid var(--navy); border-radius: 10px; box-shadow: 0 10px 30px rgba(22, 32, 46, .18); font-size: .88rem; }
.demo-tag { background: var(--navy); color: #fff; font-weight: 700; padding: 2px 8px; border-radius: 4px; }
.demo-what { font-weight: 600; color: var(--navy); margin-inline-end: 4px; }
.demo-bar .linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.lesson-bottom .demo-bar { position: static; flex: 1; justify-content: center; max-width: none; margin: 0 12px; padding: 4px 10px; box-shadow: none; }
.demo-bar .demo-what { flex: 1; text-align: center; }
.demo-bar .demo-next { padding-inline: 18px; }
.build-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 4px 0 18px; }
.build-row span { color: var(--muted); font-size: .9rem; flex: 1; min-width: 200px; }
.side-foot .rights { margin-top: 6px; }

/* logo: at the far end of each top bar */
.logo { display: block; height: 24px; width: auto; }
.lesson-top .logo, .topbar .logo { margin-inline-start: auto; }
.home-head .logo { height: 40px; }
@media (max-width: 600px) { .home-head .logo { height: 28px; } }

/* "בדיקת התכנון" (מסלול 2) */
.bsc textarea { min-height: 72px; }
.proposals { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.records td { font-family: var(--font-mono); font-size: .85rem; }
.pick { border: 0; padding: 0; margin: 0; }
.classify .q input { flex-basis: 100%; }
.classify .key { flex-basis: 100%; margin: 0; font-size: .9rem; color: var(--ink-2); }
.check-note { margin: 0; font-size: .9rem; color: var(--ink-2); }
.check-note:empty { display: none; }
.answers .q-label { margin: 10px 0 2px; font-size: .85rem; color: var(--muted); }
.answers .a { margin: 0; white-space: pre-wrap; }
.answers .a.none { color: var(--muted); }

/* session 2 pages (תכנון מבנה מסד הנתונים, הקמת מסד הנתונים) */
.note.reminder ul, .note.reminder ol { margin: 4px 0 0; padding-inline-start: 1.3em; }
.note .nf { font: 600 .72rem var(--font-mono); color: var(--blue); border: 1px solid var(--blue); border-radius: 3px; padding: 0 5px; margin-inline-start: 4px; }
/* table cards: white header with a violet stripe, key lavender, foreign keys pink */
.tcard { border: 1px solid var(--rule); border-top: 4px solid var(--blue); border-radius: 6px; padding: 0 12px 10px; margin: 0 0 14px; background: #fff; overflow: hidden; max-width: 680px; }
.tcard.given { background: var(--tint); }
.tcard-head { display: flex; gap: 10px; align-items: baseline; margin: 0 -12px 8px; padding: 8px 14px; background: #fff; color: var(--ink); border-bottom: 1px solid var(--rule); }
.tcard-head .ltr { font: 700 .98rem var(--font-mono); }
.tcard-head .he { color: var(--muted); font-size: .85rem; }
.sheet .he { color: var(--muted); font-size: .85rem; }
.tcard .tag { margin-inline-start: auto; font-size: .72rem; font-weight: 600; color: var(--blue); border: 1px solid var(--blue); background: #fff; border-radius: 99px; padding: 0 9px; }
.tcard .sheet td { font-size: .88rem; }
.tcard .sheet tr.pk td { background: var(--pk-bg); }
.tcard .sheet tr.pk td:first-child .ltr, .tcard .sheet tr.pk td:first-child input { color: var(--pk); font-weight: 600; text-decoration: underline; }
.tcard .sheet tr.fk td { background: var(--fk-bg); }
.tcard .sheet tr.fk td:first-child input { color: var(--fk); font-weight: 600; }
.tcard .sheet .target { display: flex; gap: 4px; }
.tcard .sheet input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--pk); }
.to { display: inline-block; font: 500 .82rem var(--font-mono); color: var(--fk); background: var(--fk-bg); border-radius: 3px; padding: 0 6px; }
.sheet.ref .tname { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }
.sheet.ref .pk-name { color: var(--pk); font-weight: 600; text-decoration: underline; }
a.tool { text-decoration: none; }
.demo-flash { outline: 3px solid var(--focus); outline-offset: 3px; transition: outline-color .3s; }
.sheet.ref td { text-align: start; padding: 6px 8px; vertical-align: top; }
.schema-line { font-size: .84rem; background: var(--tint); border-radius: 4px; padding: 8px 10px; overflow-x: auto; }
.choices { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.choices > span { font-weight: 500; }
.attempt { border-top: 1px solid var(--rule); padding-top: 4px; margin-top: 18px; }
pre.code { background: var(--tint); border-radius: 4px; padding: 12px; overflow-x: auto; font-family: var(--font-mono); font-size: .84rem; line-height: 1.5; direction: ltr; text-align: left; margin: 4px 0 14px; }
.code-wrap { position: relative; }
.btn.copy { position: absolute; top: 6px; right: 6px; background: #fff; }
.code-wrap pre.code { padding-right: 84px; }
.split.work-wide { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 900px) { .split.work-wide { grid-template-columns: minmax(0, 1fr); } }
.linkish.inline { border: 0; background: none; padding: 0; font: inherit; color: var(--blue); text-decoration: underline; cursor: pointer; }
.sql-input { font-family: var(--font-mono); font-size: .88rem; text-align: left; min-height: 90px; }
.records caption { caption-side: top; text-align: left; font: 600 .82rem var(--font-mono); color: var(--muted); padding: 4px 0; }
.records-order { display: grid; gap: 8px; }
.records-order .rec { border: 1px solid var(--rule); border-radius: 4px; padding: 8px 12px; background: #fff; }
.records-order .rec p { margin: 0; }
.records-order .choices { margin: 6px 0 0; }
.steps { padding-inline-start: 1.3em; }
.steps li { margin: 4px 0; }
.files-list { padding-inline-start: 1.3em; }
.files-list li { margin: 0 0 10px; }
.files-list a { font-family: var(--font-mono); font-size: .88rem; display: block; direction: ltr; text-align: right; }
.files-list span { color: var(--muted); font-size: .85rem; }
.errors li { margin: 0 0 6px; }
.attempt.extra, details.extra { border-top-style: dashed; }
pre.code.plain u { text-decoration: underline; }
.panel-body.notes h3 { font-family: var(--font); font-size: .9rem; font-weight: 700; color: var(--ink); margin: 18px 0 6px; }
.panel-body.notes h3:first-child { margin-top: 0; }
#schemaCompare li { overflow-wrap: anywhere; }

/* rules, one per row: heading, the explanation and its diagram side by side (intros and the session 2 sheets) */
.rules { margin: 22px 0; border-top: 1px solid var(--rule); }
.rule { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 36px; align-items: center; padding: 22px 0; border-bottom: 1px solid var(--rule); }
.rule h3 { grid-column: 1 / -1; margin: 0; display: flex; gap: 12px; align-items: baseline; font-size: 1.05rem; }
.rule h3 .n { font-family: var(--font-mono); font-weight: 600; color: var(--muted); }
.rule-text p { margin: 0 0 8px; color: var(--ink-2); }
.rule-text p:last-child { margin-bottom: 0; }
.rule-q-label { font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 2px !important; }
.rule-q { margin: 0 0 12px; padding-inline-start: 1.2em; }
.rule-q li { margin: 2px 0; color: var(--ink); }
.rule figure { margin: 0; }
.rule svg { display: block; width: 340px; max-width: 100%; height: auto; direction: ltr; }
@media (max-width: 640px) {
  .rule { grid-template-columns: minmax(0, 1fr); }
  .rule figure { grid-row: 2; }
}
.code-rule { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; }
.code-rule pre.code { margin: 0; }
@media (max-width: 640px) { .code-rule { grid-template-columns: minmax(0, 1fr); } }
/* SQL sheet: groups with a header band, coloured code, result tables */
.rule-group { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; background: var(--g, var(--entity)); color: #fff; border-radius: 4px; padding: 8px 14px; margin: 34px 0 0; }
.rule-group h2 { margin: 0; font-size: 1.1rem; color: #fff; }
.rule-group p { margin: 0; font-size: .9rem; color: rgba(255, 255, 255, .85); }
.rule-group + .rules { margin-top: 0; border-top: 0; }
/* SQL in the site's colours: commands violet, values (text and numbers) the foreign-key pink */
.sql-hl .k { color: var(--blue); font-weight: 600; }
.sql-hl .s, .sql-hl .d { color: var(--fk); }
.sql-hl .c { color: var(--muted); font-style: italic; }
.result { border-collapse: collapse; margin: 10px auto 0 0; font: .82rem var(--font-mono); direction: ltr; }
.result caption { caption-side: top; text-align: left; font: 600 .78rem var(--font); color: var(--muted); padding-bottom: 4px; }
.result th { background: var(--entity); color: #fff; font-weight: 600; padding: 4px 12px; text-align: left; }
.result td { border: 1px solid var(--rule); padding: 3px 12px; background: #fff; }
.g-struct { --g: var(--entity); --g-bg: var(--entity-bg); }
.g-data { --g: var(--attr); --g-bg: var(--attr-bg); }
.g-query { --g: var(--rel); --g-bg: var(--rel-bg); }
.rules[class*="g-"] .rule h3 .n { color: var(--g); }
.rule-text .cmd, .rule-text code { font: 600 .86em var(--font-mono); color: var(--entity); background: var(--entity-bg); border-radius: 3px; padding: 0 5px; }
/* the entity list (stage 2): the candidates box stays locked at the top while
   "הישויות שלי" scrolls with the page under it. Its height is capped at a third of the
   screen and a long list scrolls inside it, so it never hides the entity boxes */
@media (min-width: 901px) {
  #e1 .ebuild:not(.floating) .pool-wrap { position: sticky; top: -36px; z-index: 3; background: var(--bg); padding: 8px 0 6px; }
  #e1 .ebuild:not(.floating) .pool { max-height: 33vh; overflow-y: auto; align-content: flex-start; }
}
.card-example { margin: 18px 0; text-align: center; }
.card-example svg { display: block; max-width: 100%; height: auto; margin: 0 auto 6px; direction: ltr; }
.card-example figcaption { color: var(--muted); font-size: .9rem; }
/* the relationship table: values as wrapping text, set to the start like the solution table */
#relSheet td { text-align: start; }
#relSheet input[type="text"] { text-align: start; padding: 6px 8px; }
#relSheet .sel { position: relative; display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 8px; line-height: 1.35; cursor: pointer; }
#relSheet .sel-text { flex: 1; }
#relSheet .sel::after { content: ""; flex: none; width: 5px; height: 5px; margin-top: -3px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); }
#relSheet .sel.empty .sel-text { color: var(--muted); }
#relSheet .sel select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; padding: 0; }
#relSheet .sel:focus-within { outline: 2px solid var(--focus); outline-offset: -2px; }
#relSheet .txt { position: relative; min-height: 34px; padding: 4px 8px; line-height: 1.35; display: flex; align-items: center; cursor: text; }
#relSheet .txt.empty .sel-text { color: var(--muted); }
#relSheet .txt:not(.editing) input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
#relSheet .txt.editing .sel-text { visibility: hidden; }
#relSheet .txt.editing input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 4px 8px; background: #fff; }
#relSheet .txt:focus-within { outline: 2px solid var(--focus); outline-offset: -2px; }
#relSheet th:nth-child(3) { min-width: 5.5em; }

/* ---------- db-lab look ----------
   Same family as the other practicals on the site: light paper with a dotted grid, ink
   structure, lime for headings and the current step, violet for highlights, pill buttons.
   The ERD shapes keep their own colours (entity / attribute / relationship), as in the editor. */
body { background: var(--bg); }
.main { background: var(--bg) radial-gradient(#DDD7CD 1px, transparent 1.3px) 0 0 / 22px 22px; }
.btn { border-radius: 999px; padding: 7px 16px; font-weight: 700; transition: background .2s, color .2s, border-color .2s; }
.btn:hover { background: var(--hi); border-color: var(--ink); color: var(--ink); }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { background: #fff; border-color: var(--ink); color: var(--ink); }

/* top bar, as on the other practicals */
.lesson-top { background: rgba(250, 248, 245, .92); color: var(--ink); border-bottom: 1px solid var(--line); min-height: 58px; gap: 16px; padding: 0 clamp(16px, 3vw, 40px); }
.lesson-top .brand img { height: 30px; width: auto; display: block; }
.back-home { color: var(--ink-2); font-size: .88rem; font-weight: 500; padding-inline-start: 16px; border-inline-start: 1px solid var(--line); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.back-home:hover { color: var(--ink); }
.back-home::before { content: ""; width: 1em; height: 1em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8h9M8.5 4l4 4-4 4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8h9M8.5 4l4 4-4 4'/%3E%3C/svg%3E") center / contain no-repeat; }
.lesson-name { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-name b { unicode-bidi: isolate; font: 700 .75rem var(--font-mono); background: var(--blue); color: #fff; border-radius: 5px; padding: 2px 6px; margin-inline-end: 6px; vertical-align: 1px; }
.lesson-top .cheat-top { border: 1.5px solid var(--ink); background: var(--hi); color: var(--ink); border-radius: 999px; padding: 5px 14px; font: 700 .88rem var(--font); cursor: pointer; white-space: nowrap; }
.lesson-top .cheat-top[aria-pressed="true"] { background: var(--ink); color: var(--hi); }
.lesson-top .restart-top { margin-inline-start: auto; border: 1.5px solid var(--line); background: transparent; color: var(--ink-2); border-radius: 999px; padding: 5px 14px; font: 600 .88rem var(--font); cursor: pointer; white-space: nowrap; }
.lesson-top .restart-top:hover { border-color: var(--ink); color: var(--ink); }
.lesson-top .restart-top.armed { background: #C23B2E; border-color: #C23B2E; color: #fff; }
@media (max-width: 900px) { .lesson-name { display: none; } }
@media (max-width: 640px) { .back-home { display: none; } }

/* step strip */
.pager { background: var(--bg); border-bottom-color: var(--line); }
.route::before { border-top-color: #CFC8BC; }
.stop { border-color: #CFC8BC; }
.stop[aria-current="step"] { background: var(--hi); border-color: var(--ink); color: var(--ink); box-shadow: none; }
.stop[aria-current="step"] .lbl { color: var(--ink); }
.subnav [aria-selected="true"] .i { background: var(--hi); border-color: var(--ink); color: var(--ink); }

/* headings: the lime marker of the other practicals */
.step-head h2, .intro h2 { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.step-head h2::before, .intro h2::before { content: ""; flex: 0 0 6px; height: .8em; background: var(--hi); border-radius: 3px; }
.side-step .kind { background: var(--blue); }
.concepts strong::before { background: var(--blue); }
.tool[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
.files .ext { color: var(--blue); border-color: var(--blue); }

/* part B: where everyone starts */
.start-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin: 14px 0 6px; }
.start-figs figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.start-figs figcaption { font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.start-figs img { width: 100%; height: auto; display: block; cursor: zoom-in; }
.start-figs .start-ref { border-color: var(--blue); }
details.story-again { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 0 16px; }
details.story-again > summary { cursor: pointer; font-weight: 700; padding: 12px 0; }

/* practical 04, from ERD to schema */
.erd-fig { margin: 14px 0 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.erd-fig img { width: 100%; height: auto; display: block; cursor: zoom-in; }
.erd-fig figcaption { color: var(--muted); font-size: .88rem; margin-top: 6px; }
.panel-body .erd-fig { margin-top: 0; }
.schema-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.conventions { padding-inline-start: 1.3em; }
.conventions li { margin: 5px 0; }
.mn-try { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 10px 0; }
.records.bad td.x { background: var(--sky); color: var(--blue); font-weight: 600; }
.records td.empty { color: var(--muted); font-style: italic; font-family: var(--font); }
.records.mini { width: auto; margin: 8px 0 0; }
.records tr.rejected td { background: var(--tint); color: var(--muted); text-decoration: line-through; }
.sheet.place { max-width: 560px; }
.sheet.place select { text-align: start; }
.inline-quiz h3 { margin-top: 18px; }
.tname-inline { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }
.note .sheet-scroll { margin-top: 6px; }
.schema-lines .he-w { unicode-bidi: isolate; font-family: var(--font); }
/* 04 types stage: a type select with its length or precision, and the combination row */
.tcard.types .ty-in { display: flex; gap: 4px; align-items: center; justify-content: center; direction: ltr; }
.tcard.types .ty-in select { width: auto; min-width: 8.5em; }
.tcard.types .ty-in input[type="number"] { width: 3.6em; padding: 4px 2px; border: 1px solid var(--rule); border-radius: 3px; background: #fff; }
.tcard.types td.ask { background: #fff; box-shadow: inset 0 0 0 2px var(--sky); }
.tcard.types tr.pk td.ask, .tcard.types tr.fk td.ask { background: #fff; }
.tcard.types .colname { font-family: var(--font-mono); font-size: .86rem; }
.tcard.types tr.pk .colname { color: var(--pk); font-weight: 600; text-decoration: underline; }
.combo-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 10px 0 0; font-size: .86rem; color: var(--ink-2); }
.combo-row > span { flex-basis: 100%; }
.combo-row label.cpick { display: inline-flex; gap: 5px; align-items: center; border: 1px solid var(--rule); border-radius: 99px; padding: 2px 10px; background: #fff; cursor: pointer; }
.combo-row label.cpick input { accent-color: var(--blue); }
.sheet.ref .ty { font: 500 .8rem var(--font-mono); color: var(--muted); }
.sheet.samples { max-width: 720px; }
.sheet.samples td { text-align: start; padding: 6px 10px; font-size: .88rem; }
.sheet.samples td.ltr { font-family: var(--font-mono); }
.sheet.types-list td { text-align: start; padding: 6px 10px; }
.sheet.types-list td.ltr { font-family: var(--font-mono); white-space: nowrap; }

/* 04, Nov 23 revision: the key grid, the ERD piece of each screen, reference cards, type input */
.tcard .sheet th { background: #fff; color: var(--muted); font-size: .8rem; font-weight: 600; }
.key-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 12px 0; }
.key-grid .tcard { margin: 0; padding: 0 0 8px; }
.key-grid .tcard-head { margin: 0 0 6px; }
.key-cols { display: grid; gap: 2px; padding: 0 8px; }
.key-col { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; border: 0; background: none; padding: 5px 8px; border-radius: 4px; cursor: pointer; font: inherit; text-align: start; }
.key-col:hover:not(:disabled) { background: var(--tint); }
.key-col .colname { font-family: var(--font-mono); font-size: .86rem; }
.key-col .he { color: var(--muted); font-size: .8rem; }
.key-col.on { background: var(--pk-bg); }
.key-col.on .colname { color: var(--pk); font-weight: 700; text-decoration: underline; }
.key-col:disabled { cursor: default; }
.story-quote { margin: 8px 0 14px; padding: 10px 14px; background: #fff; border-inline-start: 3px solid var(--blue); border-radius: 4px; font-size: .95rem; }
.story-quote small { display: block; color: var(--muted); font-size: .78rem; margin-bottom: 2px; }
.walk-label { margin: 10px 0 4px; font: 700 .78rem var(--font); letter-spacing: .04em; color: var(--muted); }
.erd-piece { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; }
.erd-piece img { max-width: 100%; height: auto; cursor: zoom-in; }
.walk-arrow { text-align: center; color: var(--muted); font-size: 1.3rem; line-height: 1; margin: 6px 0 0; }
.ref-cards { display: grid; grid-template-columns: minmax(0, 560px); gap: 14px; align-items: start; }
.ref-cards.one { grid-template-columns: minmax(0, 560px); }
.ref-cards .tcard { margin: 0; }
.tcard.ref { padding: 0 10px 10px; }
.tcard.ref .tcard-head { margin: 0 -10px 10px; }
.tcard.ref .sheet td { text-align: start; padding: 5px 8px; }
.tcard.ref tr.pk td { background: var(--pk-bg); }
.tcard.ref tr.pk .colname { color: var(--pk); font-weight: 600; text-decoration: underline; }
.tcard .colname { font-family: var(--font-mono); font-size: .86rem; }
.tcard .ty { display: inline-block; font: 600 .8rem var(--font-mono); color: var(--ink); background: var(--tint); border-radius: 4px; padding: 2px 7px; }
.tcard .keytxt { font: 500 .84rem var(--font); color: var(--ink-2); white-space: nowrap; }
.tcard.types .ty-in { display: inline-flex; align-items: center; gap: 2px; direction: ltr; font: 600 .86rem var(--font-mono); color: var(--ink); }
.tcard.types .ty-in select { width: auto; min-width: 0; padding: 4px 6px; border: 1px solid var(--rule); border-radius: 4px; background: #fff; text-align: left; font: 600 .84rem var(--font-mono); color: var(--ink); }
.tcard.types .ty-params { display: inline-flex; align-items: center; gap: 1px; }
.tcard.types .ty-params input { width: 3ch; min-width: 3ch; box-sizing: content-box; padding: 2px 3px; border: 0; border-bottom: 1.5px solid var(--ink); background: transparent; font: inherit; color: var(--ink); text-align: center; }
.tcard.types .ty-params input:focus { outline: none; border-bottom-color: var(--blue); background: var(--sky); }
.tcard.types td.ask { box-shadow: inset 0 0 0 2px var(--sky); background: #fff; }
details.extra-q { margin-top: 18px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 0 16px; }
details.extra-q > summary { cursor: pointer; font-weight: 700; padding: 10px 0; }

/* 04, Nov 23 (b): card widths, the M:N side cards, the hidden example values */
.tcard.ref { max-width: 560px; }
.tcard.ref.types { max-width: 680px; }
.key-grid .tcard { max-width: none; }
/* the two sides on top, small; the linking table under them at its full width */
.mn-row { display: grid; grid-template-columns: 200px 200px minmax(0, 1fr); grid-template-areas: "a b ." "link link link"; gap: 12px; align-items: start; max-width: 680px; }
@media (max-width: 520px) { .mn-row { grid-template-columns: 1fr 1fr; grid-template-areas: "a b" "link link"; } }
.mn-row > [data-mini="Customers"] { grid-area: a; }
.mn-row > [data-mini="Bookings"] { grid-area: b; }
.mn-row > [data-schema-group] { grid-area: link; }
.mn-row .tcard { margin: 0; }
.tcard.mini { padding: 0 0 6px; }
.tcard.mini .tcard-head { margin: 0 0 4px; padding: 6px 10px; }
.mini-cols { list-style: none; margin: 0; padding: 0 10px; font-size: .84rem; }
.mini-cols li { display: flex; justify-content: space-between; padding: 3px 0; }
.mini-cols li.pk .colname { text-decoration: underline; font-weight: 700; }
.mini-cols li.more { color: var(--muted); }
details.samples-box { max-width: 680px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 0 14px; }
details.samples-box > summary { cursor: pointer; font-weight: 600; font-size: .9rem; padding: 8px 0; color: var(--ink-2); }
details.samples-box ul { margin: 0 0 10px; padding-inline-start: 1.1em; font-size: .86rem; }
details.samples-box li { margin: 3px 0; }
details.samples-box .ltr { font-family: var(--font-mono); font-size: .82rem; }
.tcard .sheet tr.fk select { min-width: 5.2em; }

/* 04 (c): the M:N "why not" screen, stacked questions */
.try-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; margin: 8px 0 14px; }
.tcard.try { width: auto; max-width: 100%; margin: 0; padding: 0 10px 8px; }
.tcard.try .tcard-head { margin: 0 -10px 8px; }
.tcard.try.wide { max-width: 680px; width: fit-content; margin: 0 0 16px; }
.tcard.try .sheet { width: auto; }
.tcard.try .records td, .tcard.try .records th { padding: 4px 12px; }
.try-why { margin: 8px 2px 0; font-size: .84rem; color: var(--ink-2); max-width: 300px; }
.records td.hv { font-family: var(--font); }
.stack .choices { display: block; margin: 0 0 14px; }
.stack .choices > span { display: block; margin-bottom: 6px; font-weight: 600; }
.stack .choices .opt { margin: 0 0 4px 6px; }
#fr .ref-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 470px), 1fr)); max-width: 1100px; }
#fr .tcard .keytxt { white-space: normal; }

/* 04 (d): the types worksheet looks a little different from the schema cards: a plain
   frame and a warm grey header, and the cells to fill are marked in the site's lime */
.tcard.ref.types { border: 1px solid var(--rule); }
.tcard.ref.types .tcard-head { background: var(--tint); }
.tcard.types td.ask { background: #FBFEE9; box-shadow: inset 0 0 0 2px #E6F39B; }
.note .tcard.try { background: #fff; margin: 8px 0; }
.tcard.try { width: fit-content; min-width: 260px; }

/* 04 (e): the list of types, a compact reference legend: no grid, the type as a chip,
   the example in a muted code font */
.sheet.types-list { width: auto; max-width: 640px; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 12px 0; }
.sheet.types-list th, .sheet.types-list td { border: 0; border-bottom: 1px solid var(--line); text-align: start; padding: 8px 14px; vertical-align: baseline; }
.sheet.types-list tr:last-child td { border-bottom: 0; }
.sheet.types-list th { background: #fff; color: var(--muted); font-size: .78rem; font-weight: 600; }
.sheet.types-list .tchip { display: inline-block; font: 600 .82rem var(--font-mono); background: var(--tint); border-radius: 4px; padding: 2px 8px; white-space: nowrap; }
.sheet.types-list td.ex { font: .82rem var(--font-mono); color: var(--muted); white-space: nowrap; text-align: start; unicode-bidi: isolate; }

/* 05: confirmations, downloads, the values table, cards side by side */
label.confirm { display: block; overflow-wrap: anywhere; margin: 10px 0; padding: 8px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; max-width: 680px; }
label.confirm input { accent-color: var(--blue); margin-inline-end: 8px; vertical-align: -2px; }
.downloads { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 14px 0; }
.sheet.records-in { max-width: 680px; }
.sheet.records-in td { text-align: start; padding: 7px 10px; }
.ref-cards.two { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); max-width: 1100px; }
.ref-cards.two .tcard .keytxt { white-space: normal; }
.panel-cards { grid-template-columns: minmax(0, 1fr); }
.panel-cards .tcard .keytxt { white-space: normal; }
.db-page pre.code { max-width: min(760px, 100%); }
.db-page .step, .db-page .code-wrap { min-width: 0; max-width: 100%; }
.db-page .stages > .step { max-width: 780px; }

/* 05: a command named in the text (db.js marks it), as on the Bar-Ilan SQL pages */
.cmd { font: 600 .86em var(--font-mono); color: var(--blue); background: var(--pk-bg); border-radius: 3px; padding: 0 5px; }

/* 05 result tables: only as wide as their columns, in the look of the 04 schema cards
   (violet stripe on top, white header with grey titles) */
.db-page .sheet.result { width: auto; max-width: 100%; margin: 10px 0 6px; border-top: 3px solid var(--blue); }
.db-page .result th { background: #fff; color: var(--muted); font: 600 .78rem var(--font-mono); border: 1px solid var(--rule); border-top: 0; padding: 6px 12px; }
.db-page .result td { text-align: left; }

/* ===================== 06: normalization (norm-page) ===================== */
.norm-page .step.wide .narrow, .norm-page .step.wide > p, .norm-page .step.wide .step.sub > p { max-width: 780px; }
.norm-page .rq { margin: 0 0 18px; }
.norm-page .rq h3.sub { margin-top: 6px; }
.norm-page .choices.stack { flex-direction: column; align-items: flex-start; }
.norm-page .choices.stack .opt { border-radius: 8px; text-align: start; padding: 6px 14px; }
.norm-page .match-row { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; border-bottom: 1px solid var(--rule); padding: 6px 0; }
.norm-page .match-row p { margin: 0; flex: 1 1 320px; }
.norm-page .match-row .choices { margin: 4px 0; }
/* the wide table */
.norm-page .wide-box { margin: 12px 0 16px; background: #fff; border: 1px solid var(--rule); border-top: 3px solid var(--blue); border-radius: 6px; padding: 8px 10px 4px; }
.norm-page .wide-head { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin-bottom: 6px; }
.norm-page .wide-head .tname { font: 700 .95rem var(--font-mono); }
.norm-page .sheet.records.wide { width: auto; min-width: 100%; direction: ltr; font-size: .8rem; margin: 0 0 6px; }
.norm-page .sheet.records th { background: #fff; color: var(--muted); font: 600 .74rem var(--font-mono); white-space: nowrap; padding: 6px 8px; }
.norm-page .sheet.records td { white-space: nowrap; padding: 4px 8px; text-align: left; font-size: .78rem; }
.norm-page .sheet.records th.key { color: var(--pk); text-decoration: underline; text-underline-offset: 3px; background: var(--pk-bg); }
.norm-page .sheet.records th.pick { cursor: pointer; }
.norm-page .sheet.records th.pick:hover { color: var(--blue); }
.norm-page .sheet.records th.sel { background: var(--blue); color: #fff; text-decoration: none; }
.norm-page .wide td { cursor: default; }
.norm-page #tbl-f1 td { cursor: pointer; }
.norm-page .sheet.records td.null { color: var(--muted); font-style: italic; }
.norm-page .sheet.records td.hit { background: var(--sky); color: var(--blue); font-weight: 600; }
.norm-page .sheet.records tr.dim td { color: #BDB7AD; }
.norm-page .sheet.records tr.changed td { background: #FBFEE9; box-shadow: inset 0 1px 0 #E6F39B, inset 0 -1px 0 #E6F39B; }
.norm-page .sheet.records tr.related td { background: var(--sky); }
.norm-page .sheet.records tr.kept td { background: #FBFEE9; }
.norm-page .sheet.records tr.gone td { background: var(--fk-bg); color: var(--fk); text-decoration: line-through; }
/* the request card and the SQL runner */
.norm-page .req-card { max-width: 780px; background: #fff; border: 1px solid var(--rule); border-radius: 6px; padding: 12px 16px; }
.norm-page .req-card h3 { margin: 4px 0 6px; font-size: 1.05rem; }
.norm-page .req-card p { margin: 0 0 6px; }
.norm-page .req-tag { font: 600 .72rem var(--font-mono); color: var(--blue); border: 1px solid var(--blue); border-radius: 99px; padding: 0 9px; }
.norm-page .sql-input.tall { min-height: 420px; font-size: .8rem; line-height: 1.45; }
.norm-page .run-row { display: flex; gap: 8px; margin: 8px 0 4px; }
.norm-page .sql-result { font: .82rem var(--font-mono); direction: ltr; text-align: left; margin: 4px 0 8px; padding: 6px 10px; border-radius: 4px; background: var(--tint); color: var(--muted); }
.norm-page .sql-result.ok { background: #E5F4EC; color: var(--ok); }
.norm-page .sql-result.warn { background: #FBFEE9; color: var(--ink-2); box-shadow: inset 0 0 0 1px #E6F39B; }
.norm-page .sql-result.err { background: var(--fk-bg); color: var(--fk); }
/* what we found */
.norm-page .echo-notes { display: grid; gap: 8px; margin: 0 0 18px; }
.norm-page .echo { background: #fff; border: 1px solid var(--rule); border-radius: 6px; padding: 8px 14px; }
.norm-page .echo p { margin: 2px 0 0; white-space: pre-wrap; }
.norm-page .echo.empty p { color: var(--muted); }
/* the dependency map */
.norm-page .fd-work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; margin: 0 0 8px; }
.norm-page .fd-compose, .norm-page .fd-map, .norm-page .tb-side { background: #fff; border: 1px solid var(--rule); border-radius: 6px; padding: 10px 14px; }
.norm-page .fd-picked { margin: 0 0 8px; font-size: .9rem; color: var(--ink-2); }
.norm-page .fd-side { border: 1px dashed var(--rule); border-radius: 6px; padding: 8px 10px; }
.norm-page .fd-label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.norm-page .fd-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; align-items: center; margin-bottom: 6px; }
.norm-page .fd-arrow { font: 700 1.1rem var(--font-mono); color: var(--blue); text-align: center; padding: 2px 0; direction: ltr; }
.norm-page .fd-compose .fd-arrow { transform: rotate(90deg); }
.norm-page .fd-actions { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.norm-page .fd-msg { font-size: .88rem; margin: 6px 0 0; min-height: 1.2em; }
.norm-page .fd-msg.err { color: var(--fk); }
.norm-page .fd-msg.ok { color: var(--ok); }
.norm-page .fd-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.norm-page .fd { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; border-bottom: 1px solid var(--rule); padding: 5px 0; }
.norm-page .fd .fdt { font: 600 .84rem var(--font-mono); }
.norm-page .fd.given .fdt { color: var(--ink-2); }
.norm-page .fd-tag { font-size: .72rem; color: var(--muted); border: 1px solid var(--rule); border-radius: 99px; padding: 0 8px; }
.norm-page .fd-note { flex-basis: 100%; margin: 2px 0 0; font-size: .84rem; padding: 3px 8px; border-radius: 4px; }
.norm-page .fd-note.ok { background: #E5F4EC; color: var(--ok); }
.norm-page .fd-note.warn { background: var(--sky); color: var(--ink-2); }
.norm-page .nchip { font: 500 .8rem var(--font-mono); border: 1px solid var(--rule); background: #fff; color: var(--ink); border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.norm-page .nchip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.norm-page .nchip.used { background: var(--pk-bg); }
.norm-page .nchip.used.on { background: var(--blue); }
.norm-page .nchip small { color: var(--muted); }
.norm-page .nchip.on small { color: #fff; }
/* the table builder */
.norm-page .tb-work { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; margin: 8px 0; }
.norm-page .col-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.norm-page .tb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.norm-page .tb-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; align-items: start; }
.norm-page .tcard.build { margin: 0; cursor: pointer; border-top-color: var(--rule); }
.norm-page .tcard.build.active { border-top-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.norm-page .tcard.build .tcard-head input { font: 700 .9rem var(--font-mono); border: 0; border-bottom: 1px dashed var(--rule); padding: 2px 0; width: 100%; min-width: 0; background: transparent; text-align: left; }
.norm-page .tcard.build .sheet { width: 100%; }
.norm-page .tcard.build .sheet td { padding: 3px 6px; text-align: start; }
.norm-page .key-btn { font: 600 .7rem var(--font-mono); border: 1px solid var(--rule); background: #fff; color: var(--muted); border-radius: 4px; padding: 1px 6px; cursor: pointer; }
.norm-page .key-btn.on { background: var(--pk); border-color: var(--pk); color: #fff; }
.norm-page .norm-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); max-width: 1100px; margin: 10px 0 14px; }
.norm-page .norm-cards .tcard .sheet td { text-align: start; padding: 4px 8px; }
.norm-page .norm-cards .keytxt { white-space: normal; font-size: .78rem; color: var(--ink-2); }
/* foreign keys */
.norm-page .fk-builder { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: end; margin: 8px 0 4px; }
.norm-page .fk-builder label { display: grid; gap: 2px; font-size: .8rem; color: var(--muted); }
.norm-page .fk-builder select { font: .85rem var(--font-mono); padding: 4px 6px; border: 1px solid var(--rule); border-radius: 4px; background: #fff; min-width: 9em; }
/* the same requests on the new tables */
.norm-page .ck-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; align-items: start; margin: 10px 0 14px; }
.norm-page .tcard.data { margin: 0; max-width: none; }
.norm-page .tcard.data .sheet.records { width: 100%; }
.norm-page .perf-box { max-width: 360px; margin: 8px 0; }
@media (max-width: 900px) {
  .norm-page .fd-work, .norm-page .tb-work { grid-template-columns: 1fr; }
}
.norm-page .linkish { border: 0; background: none; padding: 0; font: 500 .82rem var(--font); color: var(--blue); text-decoration: underline; cursor: pointer; }
.norm-page .fd .linkish { margin-inline-start: auto; }
.norm-page .sheet-scroll { direction: ltr; }
/* 06: questions as cards, numbered within each task */
.norm-page .attempt { counter-reset: rq; }
.norm-page .rq { counter-increment: rq; background: #fff; border: 1px solid var(--rule); border-radius: 8px; padding: 14px 18px 12px; margin: 14px 0; max-width: 780px; }
.norm-page .rq > h3.sub { display: block; margin: 0 0 8px; font-size: 1rem; line-height: 1.6; }
.norm-page .rq > h3.sub::before { content: counter(rq); display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--pk-bg); color: var(--blue); font: 700 .8rem var(--font-mono); margin-inline-end: 10px; vertical-align: 1px; }
.norm-page .rq > p { margin: 0 0 8px; color: var(--ink-2); }
.norm-page .rq .choices { margin: 8px 0 2px; }
.norm-page .rq .choices.stack { display: grid; gap: 6px; align-items: stretch; }
.norm-page .rq .choices.stack > span { font-weight: 600; margin-bottom: 2px; }
.norm-page .rq .choices.stack .opt { display: block; position: relative; width: 100%; text-align: start; border-radius: 6px; padding: 9px 40px 9px 14px; font-size: .9rem; }
.norm-page .rq .choices.stack .opt::before { content: ""; position: absolute; right: 14px; top: 50%; margin-top: -7px; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--rule); background: #fff; }
.norm-page .rq .choices.stack .opt[aria-pressed="true"] { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); background: var(--sky); }
.norm-page .rq .choices.stack .opt[aria-pressed="true"]::before { border-color: var(--blue); background: radial-gradient(var(--blue) 0 3.5px, #fff 4.5px); }
.norm-page .rq .choices.stack .opt.right::before { border-color: var(--ok); background: radial-gradient(var(--ok) 0 3.5px, #fff 4.5px); }
.norm-page .rq .choices.stack .opt.wrong::before { border-color: #B3261E; background: radial-gradient(#B3261E 0 3.5px, #fff 4.5px); }
.norm-page .rq .choices:not(.stack) .opt { min-width: 64px; padding: 6px 14px; font: 600 .85rem var(--font); text-align: center; }
.norm-page .rq .choices:not(.stack) .opt[aria-pressed="true"] { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); background: var(--sky); color: var(--blue); }
.norm-page .rq .match-row:last-child { border-bottom: 0; }
.norm-page .rq pre.code { margin: 6px 0 8px; }
.norm-page .story-note { border-color: var(--blue); background: var(--sky); }
.norm-page .tips { font-size: .92rem; margin: 0 0 6px; }
.norm-page .tips li { margin: 2px 0; }
/* the dependency table scrolls, with the headers kept on top */
.norm-page #tbl-f1 .sheet-scroll { max-height: 400px; overflow: auto; }
.norm-page #tbl-f1 thead th { position: sticky; top: 0; z-index: 1; }
.norm-page .wide-tools { display: inline-flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-inline-start: auto; }
.norm-page .sorter { font-size: .82rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.norm-page .sorter select { font: .8rem var(--font-mono); padding: 3px 6px; border: 1px solid var(--rule); border-radius: 4px; background: #fff; }
/* 8: the new tables as wide as their columns, no side scroll */
.norm-page .ck-tables { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.norm-page .ck-tables .tcard.data { flex: 0 1 auto; width: auto; max-width: 100%; }
.norm-page .ck-tables .tcard.data .sheet.records { width: auto; }
.norm-page .step, .norm-page .code-wrap { min-width: 0; max-width: 100%; }
.norm-page .rq .ltr { overflow-wrap: anywhere; }
.norm-page .stages > .step { max-width: 780px; }
/* 06: the corner, a staff with moving notes and a festival ticket (instead of the plane and the stamp) */
.sky.festival .staff path { fill: none; stroke: var(--ink); stroke-opacity: .55; stroke-width: .8; stroke-linecap: round; }
.sky.festival .notes { color: var(--ink); fill: var(--ink); }
.sky.festival .notes .violet { fill: var(--blue); }
.sky.festival .ticket { position: absolute; left: 4px; top: 98px; width: 112px; height: 60px; transform: rotate(-12deg); color: var(--stamp); opacity: .86; mix-blend-mode: multiply; pointer-events: none; }
.sky.festival .ticket svg { display: block; width: 100%; height: 100%; direction: ltr; unicode-bidi: isolate; overflow: visible; }
/* 06: in the step strip, a beamed pair of notes in place of the plane (same bounce and glide) */
.norm-page .hover-plane { width: 24px; height: 21px; top: -23px; }
.norm-page .hover-plane svg { display: none; }
.norm-page .hover-plane::before { content: ""; position: absolute; inset: 0; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 26'%3E%3Cellipse cx='6' cy='21' rx='5.6' ry='4.1' transform='rotate(-22 6 21)'/%3E%3Crect x='10' y='2' width='1.9' height='19' rx='.9'/%3E%3Cellipse cx='22' cy='17' rx='5.6' ry='4.1' transform='rotate(-22 22 17)'/%3E%3Crect x='26' y='-2' width='1.9' height='19' rx='.9'/%3E%3Cpath d='M10 2 L27.9 -2 L27.9 1.4 L10 5.4 Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 26'%3E%3Cellipse cx='6' cy='21' rx='5.6' ry='4.1' transform='rotate(-22 6 21)'/%3E%3Crect x='10' y='2' width='1.9' height='19' rx='.9'/%3E%3Cellipse cx='22' cy='17' rx='5.6' ry='4.1' transform='rotate(-22 22 17)'/%3E%3Crect x='26' y='-2' width='1.9' height='19' rx='.9'/%3E%3Cpath d='M10 2 L27.9 -2 L27.9 1.4 L10 5.4 Z'/%3E%3C/svg%3E") center / contain no-repeat; }

/* ---------- demo version ---------- */
.demo-small { display: none; margin: 0; padding: 10px 16px; background: var(--warn-bg); color: var(--warn); font-size: .9rem; border-bottom: 1px solid var(--line); }
@media (max-width: 900px) { .demo-small { display: block; } }
.demo-side-note { margin: 10px 0 6px; font-size: .8rem; color: var(--muted); line-height: 1.5; }
@media (max-width: 1100px) { .lesson-top .demo-contact { display: none; } }
.lesson-top .demo-contact::before { display: none; }

/* ---------- drawing relationships from the table ---------- */
#relBlock:not([data-mode="draw"]) .sheet tr > .draw-col, #relBlock.no-draw .sheet tr > .draw-col { display: none; }
#relSheet td.draw-col { text-align: center; white-space: nowrap; }
#relSheet .rel-draw.drawn { color: var(--muted); }
.rel-report { display: grid; gap: 10px; margin: 0 0 16px; }
.rel-report .rr { border: 1px solid var(--rule); border-radius: 8px; padding: 10px 14px; background: #fff; font-size: .92rem; }
.rel-report .rr ul { margin: 4px 0 0; padding-inline-start: 1.2em; }
.rel-report .rr.done { border-color: #BFE0CB; background: #F3FAF5; }
.rel-report .rr.gap { border-color: #F0DDB5; background: var(--warn-bg); }
.rel-report .rr.gap strong { color: var(--warn); }
.ask-first { border: 1.5px solid var(--ink); border-radius: 10px; background: #fff; padding: 12px 16px; margin: 0 0 16px; font-size: .92rem; }
.ask-first ul { margin: 6px 0 10px; padding-inline-start: 1.2em; }
.ask-first .btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* demo: jump menu, waiting state */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.demo-bar .demo-jump { font: 500 .85rem var(--font); color: var(--ink); background: #fff; border: 1px solid var(--rule); border-radius: 99px; padding: 4px 10px; cursor: pointer; }
.demo-bar .demo-jump:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.demo-bar .demo-next[aria-busy="true"] { opacity: .5; cursor: progress; }

/* quick checks: an explanation under each question */
.quiz .qfb { flex-basis: 100%; margin: 2px 0 0; font-size: .88rem; min-height: 0; }
.quiz .qfb:empty { display: none; }
.quiz .qfb.right { color: var(--ok); }
.quiz .qfb.wrong { color: #B3261E; }
.quiz .qfb b { font-weight: 700; }
