/* ============ Lecture template — shared by every lecture page ============ */
:root {
  --bg: #f8f5ee;
  --paper: #fffdf9;
  --paper-2: #f4efe4;
  --ink: #1e242b;
  --muted: #5b6570;
  --line: #e3dccf;
  --hero: #143642;
  --navy: #143642;
  --navy-2: #204e5f;
  --navy-soft: #e8f0f2;
  --gold: #b07d3b;
  --gold-2: #7d541f;
  --gold-soft: #f5ecd9;
  --key: #a8322a;           /* most important words */
  --green: #2a6f4e;
  --green-soft: #e4f2eb;
  --red: #b42318;
  --red-soft: #fbe9e7;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 54, 66, .05), 0 6px 20px rgba(20, 54, 66, .06);
  --serif: "Crimson Pro", Georgia, "Times New Roman", serif;
  --sans: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --arabic: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 130px; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans);
  font-size: var(--fs, 16.5px); line-height: 1.7; -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;            /* discourage copy */
}
img { max-width: 100%; display: block; -webkit-user-drag: none; }
button { font: inherit; cursor: pointer; }
[dir="rtl"] { font-family: var(--arabic); text-align: right; }

/* ---------- header ---------- */
.hero { background: var(--hero); color: #fffdf9; border-bottom: 4px solid var(--gold); }
.hero-inner { max-width: 900px; margin: 0 auto; padding: 22px 18px 46px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.back { color: #cbd5df; text-decoration: none; font-size: 14px; font-weight: 600; }
.hero-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lang-toggle { display: inline-flex; align-items: center; gap: 2px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .15); border-radius: 999px; padding: 3px; }
.lang-label { font-size: 12px; color: #cbd5df; padding: 0 6px 0 8px; }
.lang-toggle button { border: 0; background: transparent; color: #cbd5df; padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; font-family: var(--arabic); }
.lang-toggle button.active { background: var(--gold); color: #fff; }
.pill {
  font-size: 12px; font-weight: 700; letter-spacing: .4px; padding: 5px 12px; border-radius: 20px;
  background: rgba(176, 125, 59, .25); color: #f6dfb7; border: 1px solid rgba(246, 223, 183, .4);
}
.pill.open { background: rgba(42, 111, 78, .35); color: #b9f3d5; border-color: rgba(185, 243, 213, .4); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: #fffdf9; }
.brand img { width: 34px; height: auto; display: block; }
.brand .bn { font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1; letter-spacing: .2px; }
.brand .bn small { display: block; font-family: var(--sans, inherit); font-size: 9.5px; font-weight: 700; letter-spacing: 3.5px; color: #e8c78e; margin-top: 4px; }
.brand .arr { color: #cbd5df; font-size: 16px; margin-right: -2px; }
.brand:hover .bn { color: #e8c78e; }
.course { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #e8c78e; }
.hero h1 { font-family: var(--serif); font-size: clamp(28px, 5vw, 40px); line-height: 1.15; margin: 8px 0 10px; font-weight: 700; }
.hero p { color: #cbd5df; margin: 0; max-width: 640px; font-size: 15px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 13.5px; color: #e8c78e; }

/* ---------- sticky bar: tabs + toc ---------- */
.bar { position: sticky; top: 0; z-index: 40; margin-top: -26px; }
.tabs { max-width: 900px; margin: 0 auto; padding: 0 18px; display: flex; gap: 10px; }
.tab {
  flex: 1; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper);
  color: var(--muted); font-weight: 700; font-size: 14.5px; box-shadow: 0 4px 14px rgba(20, 54, 66, .08); transition: .2s;
}
.tab.active { background: var(--gold); color: #fffdf9; border-color: var(--gold); }
.toc-wrap { background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); margin-top: 10px; position: relative; }
.toc { max-width: 900px; margin: 0 auto; padding: 8px 18px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.toc::-webkit-scrollbar { display: none; }
.toc a {
  flex: none; font-size: 13px; text-decoration: none; color: var(--muted); background: var(--paper);
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; font-weight: 600;
}
.toc a.active { color: var(--paper); background: var(--navy); border-color: var(--navy); }
.toc a.locked::after { content: " 🔒"; }
.progress { position: absolute; left: 0; bottom: -1px; height: 3px; width: 0; background: var(--gold); }
body.view-cards .toc-wrap { display: none; }

/* ---------- layout ---------- */
main { max-width: 900px; margin: 0 auto; padding: 8px 18px 80px; }
.view[hidden] { display: none; }

/* ---------- section cards ---------- */
.block { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin: 18px 0; }
.block-head { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 14px; }
.block-num { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--hero); color: #e8c78e; font-weight: 800; font-size: 15px; }
.block h2 { font-family: var(--serif); font-size: clamp(21px, 3vw, 25px); line-height: 1.25; margin: 0; flex: 1; color: var(--navy); }
.badge { flex: none; font-size: 11px; font-weight: 800; letter-spacing: .5px; padding: 4px 10px; border-radius: 6px; }
.badge.free { background: var(--green-soft); color: var(--green); }
.badge.pro { background: var(--gold-soft); color: var(--gold); }
.unlocked .badge.pro { background: var(--green-soft); color: var(--green); }
.unlocked .badge.pro::after { content: " ✓"; }

/* ---------- paragraph unit ---------- */
.para { padding: 4px 0 16px; border-bottom: 1px dashed var(--line); margin-bottom: 14px; }
.para:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.para h3 { font-size: 16.5px; margin: 6px 0 6px; color: var(--navy); }
.para p { margin: 6px 0; }
.grid { display: grid; grid-template-columns: 1fr; gap: 14px 24px; align-items: start; }
@media (min-width: 820px) { .grid.fig { grid-template-columns: 1.5fr 1fr; } }

.key { color: var(--key); font-weight: 700; }
.def { border-left: 4px solid var(--gold); background: var(--gold-soft); padding: 12px 16px; border-radius: 0 12px 12px 0; margin: 6px 0 10px; font-size: 17px; }
.def b { color: var(--navy); }
ol.clean, ul.clean { padding-left: 0; list-style: none; margin: 6px 0; counter-reset: n; }
ol.clean li, ul.clean li { position: relative; padding: 6px 0 6px 36px; }
ol.clean li::before {
  counter-increment: n; content: counter(n); position: absolute; left: 0; top: 7px; width: 25px; height: 25px; border-radius: 7px;
  background: var(--navy-soft); color: var(--navy); font-weight: 800; font-size: 13px; display: grid; place-items: center;
}
ul.clean li::before { content: ""; position: absolute; left: 10px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }

figure { margin: 0; }
figure img { border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: zoom-in; margin: 0 auto; max-height: 420px; object-fit: contain; }
figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 6px; font-weight: 600; }

/* ---------- glossary terms ---------- */
.gl {
  border: 0; padding: 0 4px; font-weight: 700; color: var(--navy); background: rgba(176, 125, 59, .14);
  border-bottom: 1.5px dashed var(--gold); border-radius: 4px; line-height: 1.4; transition: .15s;
}
.gl:hover, .gl.on { background: var(--navy); color: var(--paper); border-bottom-style: solid; }
.pop {
  position: absolute; z-index: 55; width: min(340px, calc(100vw - 24px)); background: var(--paper); border: 1.5px solid var(--navy);
  border-top: 5px solid var(--gold); border-radius: 12px; padding: 12px 14px; box-shadow: 0 12px 30px rgba(20, 54, 66, .18);
  display: none; animation: fade .15s ease;
}
.pop.open { display: block; }
.pop-title { font-weight: 800; color: var(--navy); font-size: 14.5px; margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; }
.pop-title button { border: 0; background: var(--paper-2); border-radius: 6px; font-size: 12px; padding: 1px 8px; }
.pop-body { font-size: 14.5px; line-height: 1.75; }
@keyframes fade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- per-paragraph toolbar + drawers ---------- */
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 700;
  border: 1px solid; transition: .15s;
}
.tool[hidden] { display: none; }
.tool.tr { background: #e8f1ee; color: #1a4d3e; border-color: #b7d3c9; }
.tool.tr.on, .tool.tr:hover { background: #1a4d3e; color: #fff; border-color: #1a4d3e; }
.tool.pearl { background: var(--gold-soft); color: var(--gold-2); border-color: #dfc49b; }
.tool.pearl.on, .tool.pearl:hover { background: var(--gold); color: #fff; border-color: var(--gold); }
.tool.listen { background: var(--navy-soft); color: var(--navy); border-color: #c6d6dc; }
.tool.listen.on, .tool.listen:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.tool.listen.on .ico { animation: pulse 1.1s infinite; display: inline-block; }
@keyframes pulse { 50% { transform: scale(1.25); } }

.drawer { display: none; margin-top: 10px; border-radius: 12px; padding: 12px 16px; font-size: 15.5px; line-height: 1.85; animation: fade .18s ease; }
.drawer.open { display: block; }
.drawer.tr { background: #f1f7f5; border: 1px solid #c6ddd5; border-right: 4px solid #1a4d3e; }
.drawer.pearl { background: var(--gold-soft); border: 1px solid #e2cca8; border-right: 4px solid var(--gold); }
.drawer strong.lbl { display: block; font-size: 13px; margin-bottom: 2px; }
.drawer.tr strong.lbl { color: #1a4d3e; }
.drawer.pearl strong.lbl { color: var(--gold-2); }
.drawer ol, .drawer ul { margin: 4px 0; padding-right: 20px; padding-left: 0; }
.drawer bdi, .drawer .en { font-family: var(--sans); direction: ltr; unicode-bidi: isolate; font-size: 14.5px; }

/* ---------- video ---------- */
.video { margin-top: 14px; background: #18232a; border-radius: 12px; padding: 12px; color: #e8c78e; font-size: 13px; font-weight: 700; }
.video-frame { position: relative; padding-top: 56.25%; border-radius: 8px; overflow: hidden; background: #0d1317; margin-top: 8px; }
.video-frame iframe, .video-frame .soon { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-frame .soon { display: grid; place-items: center; color: #8a99a6; font-weight: 600; }

/* ---------- MCQ ---------- */
.mcq { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-top: 14px; background: var(--paper-2); }
.mcq-label { font-size: 11.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); }
.mcq-q { font-weight: 700; margin: 4px 0 10px; color: var(--navy); }
.mcq-opt {
  display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  border-radius: 10px; padding: 10px 14px; margin: 7px 0; transition: .15s;
}
.mcq-opt:hover:not(:disabled) { border-color: var(--navy); }
.mcq-opt.correct { background: var(--green-soft); border-color: var(--green); color: var(--green); font-weight: 700; }
.mcq-opt.wrong { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.mcq-opt:disabled { cursor: default; }
.mcq-why { display: none; font-size: 15px; margin-top: 8px; }
.mcq.answered .mcq-why { display: block; }

/* ---------- lock gate ---------- */
.gate { text-align: center; border-radius: var(--radius); padding: 28px 22px; margin: 26px 0; background: var(--hero); color: #fffdf9; border-bottom: 4px solid var(--gold); box-shadow: var(--shadow); }
.gate h2 { font-family: var(--serif); margin: 4px 0; font-size: 26px; }
.gate p { color: #cbd5df; margin: 4px auto 16px; max-width: 520px; }
.gate form { display: flex; gap: 8px; max-width: 420px; margin: 0 auto; flex-wrap: wrap; justify-content: center; }
.gate input {
  flex: 1 1 220px; border: 0; border-radius: 10px; padding: 12px 14px; font: inherit; text-transform: uppercase; letter-spacing: 2px;
  text-align: center; -webkit-user-select: text; user-select: text;
}
.gate button { border: 0; border-radius: 10px; padding: 12px 20px; background: var(--gold); color: #fff; font-weight: 800; }
.gate .msg { min-height: 24px; margin-top: 10px; font-size: 14.5px; color: #f6dfb7; }
.gate .contact { font-size: 13px; color: #cbd5df; margin-top: 4px; }
.locked-preview { filter: blur(6px); opacity: .5; pointer-events: none; }
.unlocked .gate, .unlocked .locked-preview { display: none; }

/* ---------- flashcards ---------- */
.deck { max-width: 620px; margin: 22px auto 0; }
.deck-top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.card { perspective: 1200px; height: 280px; cursor: pointer; }
.card-inner { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.card.flipped .card-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: 18px; padding: 26px; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center; border: 2px solid var(--line); box-shadow: 0 10px 28px rgba(20, 54, 66, .08);
}
.face .tag { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); margin-bottom: 12px; }
.face.front { background: var(--paper); }
.face.front .txt { font-family: var(--serif); font-size: 24px; font-weight: 600; color: var(--navy); line-height: 1.35; }
.face.back { background: var(--hero); color: #fffdf9; transform: rotateY(180deg); font-size: 17px; }
.face.back .tag { color: #e8c78e; }
.card.locked .face.front { background: var(--paper-2); }
.card.locked .txt { font-family: var(--sans); font-size: 17px; color: var(--muted); }
.deck-btns { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.btn { border: 1px solid var(--navy); background: var(--paper); color: var(--navy); border-radius: 10px; padding: 9px 16px; font-weight: 700; font-size: 14px; }
.btn.primary { background: var(--navy); color: var(--paper); }
.btn.good { color: var(--green); border-color: var(--green); }
.btn.again { color: var(--red); border-color: var(--red); }
.deck-done { display: none; text-align: center; padding: 30px; }

/* ---------- animation triggers (phrases that open an animation) ---------- */
.ax {
  border: 0; background: transparent; padding: 0; color: inherit; font-weight: 700; text-align: inherit;
  text-decoration: underline 2px var(--gold); text-underline-offset: 4px; cursor: pointer; line-height: inherit;
}
.ax::after {
  content: "▶"; display: inline-grid; place-items: center; width: 19px; height: 19px; margin-left: 5px; border-radius: 50%;
  background: var(--gold); color: #fff; font-size: 9px; vertical-align: 2px; text-decoration: none;
}
.ax.key { color: var(--key); }
.ax:hover { color: var(--navy); background: var(--gold-soft); }

/* ---------- animation player ---------- */
.anim-modal { position: fixed; inset: 0; z-index: 65; background: rgba(10, 20, 28, .72); display: grid; place-items: center; padding: 14px; }
.anim-modal[hidden] { display: none; }
.anim-box { background: var(--paper); border-radius: 18px; width: min(640px, 100%); max-height: 96vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); border-top: 5px solid var(--gold); }
.anim-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.anim-head b { flex: 1; font-family: var(--serif); font-size: 21px; color: var(--navy); }
.anim-head button { border: 0; background: var(--paper-2); border-radius: 8px; padding: 4px 10px; font-weight: 700; }
.anim-stage { padding: 12px 14px 0; }
.anim-cap { padding: 10px 18px 4px; min-height: 104px; }
.anim-cap .en { margin: 0 0 4px; font-weight: 600; color: var(--navy); }
.anim-cap .ar { margin: 0; color: var(--ink); font-size: 15.5px; line-height: 1.8; }
.anim-ctrl { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 14px 16px; }
.anim-ctrl .dots { display: flex; gap: 6px; }
.anim-ctrl .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); cursor: pointer; }
.anim-ctrl .dots i.on { background: var(--gold); width: 22px; border-radius: 6px; }

/* ---------- animation drawings: shared parts ---------- */
.anim-stage svg { width: 100%; height: auto; display: block; background: #fbf8f2; border-radius: 12px; border: 1px solid var(--line); font-family: var(--sans); }
.anim-stage svg * { transition: transform 1.1s cubic-bezier(.4, 0, .2, 1), opacity .5s ease, fill .5s ease; }
.anim-stage svg .vb { transform-box: view-box; }
.anim-stage .bone { fill: #ead9b5; }
.anim-stage .muc rect, .anim-stage rect.muc { fill: #f2a3ad; }
.anim-stage .base { fill: #cf4b62; }
.anim-stage .tooth { fill: #fff; stroke: #9aa5b1; stroke-width: 1.5; }
.anim-stage .metal { fill: #7f8d99; }
.anim-stage .arrow { fill: var(--navy); }
.anim-stage .arrow.up { fill: #b07d3b; }
.anim-stage .food { fill: #8a5a2b; opacity: .85; }
.anim-stage .lbl { font-size: 13px; font-weight: 700; fill: var(--navy); }
.anim-stage .lbl.red { fill: #b42318; }
.anim-stage .lbl.green { fill: #2a6f4e; }
.anim-stage .fulcrum { fill: #f6c453; stroke: var(--navy); stroke-width: 2; }
.anim-stage .only { opacity: 0; }
svg[data-step="1"] .on1, svg[data-step="2"] .on2, svg[data-step="3"] .on3 { opacity: 1; }

/* support vs retention */
.a-support[data-step="1"] .dent { transform: translateY(9px); }
.a-support[data-step="1"] .muc { transform: scaleY(.62); }
.a-support[data-step="2"] .dent { transform: translateY(-16px); }

/* composite support: stable tooth vs resilient mucosa */
.a-composite:is([data-step="1"], [data-step="2"]) .abut { transform: translateY(1.5px); }
.a-composite:is([data-step="1"], [data-step="2"]) .dent { transform: translateY(12px); }
.a-composite:is([data-step="1"], [data-step="2"]) .muc { transform: scaleY(.5); }

/* area of coverage */
.a-area:is([data-step="1"], [data-step="2"]) .bA { transform: translateY(14px); }
.a-area:is([data-step="1"], [data-step="2"]) .mucA { transform: scaleY(.42); }
.a-area:is([data-step="1"], [data-step="2"]) .bB { transform: translateY(5px); }
.a-area:is([data-step="1"], [data-step="2"]) .mucB { transform: scaleY(.8); }

/* distal extension rotation + indirect retainer */
.a-rotation[data-step="1"] .dent { transform: rotate(3deg); }
.a-rotation[data-step="1"] .abut { transform: rotate(2deg); }
.a-rotation[data-step="1"] .abut .crown { fill: #ffd2cc; }
.a-rotation[data-step="1"] .muc { transform: scaleY(.55); }
.a-rotation[data-step="2"] .dent { transform: rotate(-7deg); }
.a-rotation[data-step="3"] .dent { transform: rotate(-.8deg); }
.a-rotation[data-step="3"] .irrest { fill: #2a6f4e; }

/* anatomic vs functional impression */
svg[data-step="0"] .on0 { opacity: 1; }
.a-impression[data-step="1"] .dent { transform: rotate(4deg); }
.a-impression[data-step="1"] .abut { transform: rotate(2deg); }
.a-impression[data-step="1"] .abut .crown { fill: #ffd2cc; }
.a-impression[data-step="1"] .muc { transform: scaleY(.5); }
.a-impression[data-step="2"] .dent { transform: rotate(.6deg); }
.a-impression[data-step="2"] .muc { transform: scaleY(.85); }

/* selective pressure: tray relief */
.a-relief:is([data-step="2"], [data-step="3"]) .tray { transform: translateY(10px); }
.a-relief:is([data-step="2"], [data-step="3"]) .mShelf { transform: scaleY(.55); }

/* ---------- watermark ---------- */
.watermark {
  position: fixed; inset: -50%; z-index: 30; pointer-events: none; opacity: .05; transform: rotate(-24deg);
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 150px 170px; color: var(--navy);
}
.wm-t { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.wm-t img { width: 30px; height: auto; filter: grayscale(1) brightness(.35); }
.wm-t b { font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: .3px; }
.wm-t i { font-style: normal; font-size: 13px; font-weight: 700; letter-spacing: 1px; padding-left: 10px; border-left: 1.5px solid currentColor; }
body.dark .wm-t img { filter: grayscale(1) brightness(2.2); }

/* ---------- lightbox / toast ---------- */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(8, 14, 20, .88); display: none; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox.open { display: grid; }
.lightbox img { max-height: 92vh; max-width: 96vw; border-radius: 10px; background: #fff; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(30px); opacity: 0; z-index: 70;
  background: var(--hero); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14.5px; transition: .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 18px 50px; }

/* ===================== study tools ===================== */

/* settings + timer buttons in the header */
.icon-btn { border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #fffdf9; border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 700; }
.settings { position: fixed; z-index: 62; top: 60px; right: max(12px, calc(50% - 440px)); width: min(320px, calc(100vw - 24px)); background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: 14px; padding: 14px 16px; box-shadow: 0 16px 40px rgba(0, 0, 0, .2); }
.settings[hidden] { display: none; }
.settings h4 { margin: 0 0 8px; font-family: var(--serif); font-size: 19px; color: var(--navy); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.set-row:last-child { border-bottom: 0; }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 700; }
.seg button.on { background: var(--gold); color: #fff; }
.switch { position: relative; width: 42px; height: 24px; border-radius: 999px; border: 0; background: var(--line); flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.switch.on { background: var(--green); }
.switch.on::after { left: 21px; }

/* section progress */
.hero-progress { margin-top: 16px; max-width: 420px; }
.hero-progress .track { height: 7px; border-radius: 9px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.hero-progress .fill { height: 100%; width: 0; background: var(--gold); transition: width .4s; }
.hero-progress small { display: block; margin-top: 5px; color: #cbd5df; font-size: 12.5px; }
.done-row { display: flex; justify-content: flex-end; margin-top: 14px; }
.done-btn { border: 1px solid var(--green); color: var(--green); background: transparent; border-radius: 999px; padding: 6px 14px; font-size: 13.5px; font-weight: 700; }
.done-btn.on { background: var(--green); color: var(--paper); }
.toc a.done::before { content: "✓ "; color: var(--green); }
.toc a.done.active::before { color: #b9f3d5; }

/* star + note per paragraph */
.tool.star { background: transparent; color: var(--muted); border-color: var(--line); }
.tool.star.on { background: #fff4d6; color: #9a6b12; border-color: #e7c66d; }
.tool.note { background: transparent; color: var(--muted); border-color: var(--line); }
.tool.note.has { color: var(--navy); border-color: var(--navy); }
.para.starred { box-shadow: inset 4px 0 0 #e7c66d; padding-left: 12px; border-radius: 4px; }
.drawer.note { background: var(--paper-2); border: 1px solid var(--line); }
.drawer.note textarea { width: 100%; min-height: 90px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: inherit; font-size: 15px; background: var(--paper); color: var(--ink); -webkit-user-select: text; user-select: text; }
.drawer.note small { color: var(--muted); font-size: 12.5px; }

/* image hotspots */
.hotspots { position: relative; display: inline-block; width: 100%; }
.hotspots img { cursor: default; max-height: none; width: 100%; }
.hs {
  position: absolute; transform: translate(-50%, -50%); width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff;
  background: var(--gold); color: #fff; font-weight: 800; font-size: 13px; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); padding: 0;
}
.hs::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--gold); animation: ring 1.8s infinite; }
.hs.seen { background: var(--hero); }
.hs.seen::before { animation: none; border-color: transparent; }
@keyframes ring { 0% { transform: scale(.8); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
.pop-body p { margin: 0 0 6px; }
.pop-body .en { font-family: var(--sans); color: var(--navy); font-weight: 600; font-size: 14px; }

/* motivation quote */
.quote { text-align: center; margin: 22px auto; max-width: 560px; padding: 16px 20px; border-radius: 14px; background: linear-gradient(135deg, var(--gold-soft), var(--paper)); border: 1px dashed var(--gold); }
.quote p { margin: 0; font-size: 17px; font-weight: 700; color: var(--gold-2); }
.quote small { color: var(--muted); font-size: 12.5px; }

/* quiz */
.quiz-wrap, .summary-wrap { max-width: 760px; margin: 22px auto 0; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--muted); font-weight: 600; font-size: 14px; }
.quiz-bar { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 14px; }
.quiz-bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s; }
.quiz-result { text-align: center; padding: 26px 10px; }
.quiz-result .big { font-family: var(--serif); font-size: 46px; color: var(--navy); font-weight: 700; }
.review-item { text-align: left; border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 10px; padding: 10px 14px; margin: 10px 0; background: var(--paper); font-size: 15px; }
.review-item b { color: var(--navy); }
.review-item .ok { color: var(--green); font-weight: 700; }

/* summary */
.sum-sec { border-left: 4px solid var(--gold); padding: 4px 0 4px 14px; margin: 16px 0; }
.sum-sec h3 { margin: 0 0 4px; color: var(--navy); font-family: var(--serif); font-size: 20px; }
.sum-sec ul { margin: 4px 0; padding-left: 20px; }
.sum-sec li { margin: 3px 0; }
.sum-locked { filter: blur(5px); opacity: .5; pointer-events: none; }
.unlocked .sum-locked { filter: none; opacity: 1; pointer-events: auto; }
.mine { margin-top: 18px; }
.mine a { color: var(--navy); font-weight: 600; }
.mine .note-text { white-space: pre-wrap; color: var(--ink); background: var(--paper-2); border-radius: 8px; padding: 8px 12px; margin: 4px 0 10px; font-size: 14.5px; }

/* spaced repetition */
.srs-info { text-align: center; color: var(--muted); font-size: 13.5px; margin: 10px 0 0; }
.deck-empty { display: none; text-align: center; padding: 30px 10px; }

/* pomodoro chip + break */
.timer-chip { position: fixed; left: 14px; bottom: 14px; z-index: 45; border: 1px solid var(--line); background: var(--paper); color: var(--navy); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; box-shadow: var(--shadow); }
.timer-chip[hidden] { display: none; }
.break-modal { position: fixed; inset: 0; z-index: 66; background: rgba(10, 20, 28, .75); display: grid; place-items: center; padding: 14px; }
.break-modal[hidden] { display: none; }
.break-box { background: var(--paper); border-radius: 18px; width: min(560px, 100%); max-height: 96vh; overflow: auto; padding: 22px; text-align: center; border-top: 5px solid var(--green); }
.break-box h3 { font-family: var(--serif); font-size: 26px; margin: 4px 0; color: var(--navy); }
.break-box p { color: var(--muted); margin: 6px 0 14px; }
.break-count { font-family: var(--serif); font-size: 44px; font-weight: 700; color: var(--green); margin: 6px 0; }
.breathe { width: 110px; height: 110px; border-radius: 50%; margin: 14px auto; background: radial-gradient(circle, #b9f3d5, #2a6f4e); animation: breathe 8s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(.6); } 50% { transform: scale(1); } }
.break-tips { text-align: right; direction: rtl; font-family: var(--arabic); background: var(--paper-2); border-radius: 12px; padding: 10px 16px; margin: 10px 0; font-size: 15px; }
.break-tips li { margin: 4px 0; }
.break-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

/* ===================== 📍 locator: term → picture with a moving pointer ===================== */
:root { --loc: #0f7f62; --loc-soft: #e1f5ee; }
body.dark { --loc: #5dcaa5; --loc-soft: #123128; }
.loc {
  border: 0; padding: 0 3px; font: inherit; font-weight: 700; color: var(--loc); background: var(--loc-soft);
  border-radius: 4px; border-bottom: 2px solid var(--loc); cursor: pointer; line-height: 1.4;
}
.loc::after { content: "📍"; font-size: .8em; margin-left: 2px; }
.loc:hover { background: var(--loc); color: var(--paper); }
.legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px; margin: 16px 0 0; font-size: 14px; color: var(--muted);
}
.legend b { color: var(--ink); }
.legend .lg-gl { border-bottom: 1.5px dashed var(--gold); background: rgba(176, 125, 59, .14); padding: 0 4px; border-radius: 4px; color: var(--navy); font-weight: 700; }
.legend .lg-ax { text-decoration: underline 2px var(--gold); text-underline-offset: 4px; font-weight: 700; color: var(--ink); }
.legend .lg-ax::after { content: " ▶"; color: var(--gold); font-size: .8em; }
.legend .x { margin-left: auto; border: 0; background: var(--paper-2); border-radius: 6px; padding: 2px 9px; font-size: 12px; }

.loc-modal { position: fixed; inset: 0; z-index: 65; background: rgba(10, 20, 28, .72); display: grid; place-items: center; padding: 14px; }
.loc-modal[hidden] { display: none; }
.loc-box { background: var(--paper); border-radius: 18px; width: min(720px, 100%); max-height: 96vh; overflow: auto; border-top: 5px solid var(--loc); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.loc-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.loc-head b { flex: 1; font-family: var(--serif); font-size: 21px; color: var(--navy); }
.loc-head button { border: 0; background: var(--paper-2); border-radius: 8px; padding: 4px 10px; font-weight: 700; }
.loc-tabs { display: flex; gap: 6px; padding: 10px 16px 0; flex-wrap: wrap; }
.loc-tabs button { border: 1px solid var(--line); background: var(--paper); color: var(--muted); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700; }
.loc-tabs button.on { background: var(--loc); border-color: var(--loc); color: #fff; }
.loc-stage { position: relative; margin: 10px 16px 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fbf8f2; }
.loc-stage img, .loc-stage svg { display: block; width: 100%; height: auto; }
.loc-stage .lt { font: 600 13px var(--sans); fill: #5b6570; }
.loc-stage .lz { opacity: 0; transition: opacity .5s; }
.loc-stage .lz.on-base, .loc-stage .lz.on { opacity: 1; }
.loc-pin { position: absolute; width: 0; height: 0; transition: left .7s cubic-bezier(.4, 0, .2, 1), top .7s cubic-bezier(.4, 0, .2, 1); pointer-events: none; }
.loc-pin i { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: #1D9E75; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.loc-pin i::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; border: 3px solid #1D9E75; animation: locring 1.5s ease-out infinite; }
.loc-pin s { position: absolute; left: -11px; top: -46px; width: 0; height: 0; border-left: 11px solid transparent; border-right: 11px solid transparent; border-top: 18px solid #0F6E56; animation: locbob 1.1s ease-in-out infinite; }
@keyframes locring { 0% { transform: scale(.5); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes locbob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@media (prefers-reduced-motion: reduce) { .loc-pin i::before, .loc-pin s { animation: none; } }
.loc-credit { font-size: 11.5px; color: var(--muted); padding: 4px 16px 0; }
.loc-credit a { color: var(--muted); }
.loc-cap { padding: 10px 18px 16px; }
.loc-cap .en { margin: 0 0 6px; font-weight: 600; color: var(--navy); }
.loc-cap .ar { margin: 0; font-size: 15.5px; line-height: 1.8; }

/* ===================== 🔍 search ===================== */
.tab.tab-search { flex: 0 0 52px; padding: 12px 0; }
.search-panel { position: fixed; inset: 0; z-index: 64; background: rgba(10, 20, 28, .6); display: flex; justify-content: center; align-items: flex-start; padding: 60px 12px 12px; }
.search-panel[hidden] { display: none; }
.search-box { background: var(--paper); width: min(680px, 100%); max-height: 80vh; display: flex; flex-direction: column; border-radius: 16px; border-top: 4px solid var(--gold); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); overflow: hidden; }
.search-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.search-head input, .lib-results input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; background: var(--paper-2); color: var(--ink); -webkit-user-select: text; user-select: text; }
.search-head button { border: 0; background: var(--paper-2); border-radius: 8px; padding: 0 12px; font-weight: 700; }
.search-res { overflow: auto; padding: 6px 12px 12px; }
.s-item { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px dashed var(--line); background: transparent; color: var(--ink); padding: 10px 4px; }
.s-item:hover { background: var(--paper-2); }
.s-where { display: block; font-size: 12.5px; font-weight: 800; color: var(--gold); margin-bottom: 2px; }
.s-snip { display: block; font-size: 14.5px; line-height: 1.6; }
.s-snip[dir="rtl"] { text-align: right; font-family: var(--arabic); }
.s-item mark, mark.hit { background: #ffe58a; color: #1e242b; border-radius: 3px; padding: 0 1px; }
mark.hit { box-shadow: 0 0 0 3px #ffe58a; animation: hitpulse 1.2s ease 2; }
@keyframes hitpulse { 50% { box-shadow: 0 0 0 6px #ffe58a88; } }
.s-hint { color: var(--muted); font-size: 14px; padding: 10px 4px; }

/* ===================== 🚩 report ===================== */
.tool.report { background: transparent; color: var(--muted); border-color: var(--line); }
.tool.report.on { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.drawer.report { background: var(--paper-2); border: 1px solid var(--line); }
.rep-kind { display: flex; gap: 6px; margin: 6px 0 8px; }
.rep-kind button { border: 1px solid var(--line); background: var(--paper); color: var(--muted); border-radius: 999px; padding: 4px 12px; font: 700 13px var(--arabic); }
.rep-kind button.on { background: var(--navy); color: var(--paper); border-color: var(--navy); }
.drawer.report textarea { width: 100%; min-height: 70px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: inherit; font-size: 15px; background: var(--paper); color: var(--ink); -webkit-user-select: text; user-select: text; }
.rep-send { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.rep-send small { color: var(--muted); }

/* ===================== dark mode ===================== */
body.dark {
  --bg: #0f171c; --paper: #172229; --paper-2: #1e2c35; --ink: #e5ebee; --muted: #9fb0bb; --line: #2b3b45;
  --hero: #0a161c; --navy: #a9cfe0; --navy-2: #c5e0ec; --navy-soft: #1c2d37; --gold: #d3a15f; --gold-2: #e8c28d; --gold-soft: #2a2317;
  --key: #ff9b8c; --green: #6fcf97; --green-soft: #183322; --red: #ff8a80; --red-soft: #3a201e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .3);
}
body.dark .tool.tr { background: #18302a; color: #9ee0c6; border-color: #2c5246; }
body.dark .tool.pearl { color: var(--gold-2); border-color: #5a4626; }
body.dark .tool.listen { background: var(--navy-soft); border-color: #31505f; }
body.dark .drawer.tr { background: #162a25; border-color: #2c5246; border-right-color: #6fcf97; }
body.dark .drawer.tr strong.lbl { color: #9ee0c6; }
body.dark .drawer.pearl { border-color: #5a4626; }
body.dark .tool.star.on { background: #3a3018; color: #f1cf6b; border-color: #7a6424; }
body.dark .gl { color: var(--gold-2); }
body.dark .gate input { background: #fff; color: #1e242b; }
body.dark figure img, body.dark .hotspots img { filter: brightness(.92); }
body.dark .anim-stage .lbl { fill: #143642; }
body.dark .anim-stage .arrow { fill: #143642; }

@media (max-width: 600px) {
  .block { padding: 18px 15px; }
  .tab { font-size: 13.5px; padding: 11px 8px; }
  .tool { font-size: 12.5px; padding: 6px 10px; }
  .card { height: 320px; }
}
@media print { body { display: none; } }   /* block printing */
