/* StudyExam v3.4: knowledge diagrams (body parts, plant parts, cells) */
.kd { --kd-blue: #004ac6; --kd-orange: #fe932c; --kd-line: #e2e8f0; display: grid; gap: 14px; font-family: Inter, "Noto Sans Sinhala", system-ui, sans-serif; color: #0b1c30; }
.kd-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.kd-seg { display: inline-flex; background: #fff; border: 1px solid #c3c6d7; border-radius: 16px; padding: 4px; gap: 3px; box-shadow: 0 1px 2px rgba(11, 28, 48, .06); }
.kd-seg button { border: 0; background: transparent; font: inherit; font-weight: 700; font-size: 14px; padding: 8px 14px; border-radius: 12px; cursor: pointer; color: #434655; }
.kd-seg button.on { background: var(--kd-blue); color: #fff; box-shadow: 0 1px 3px rgba(0, 74, 198, .35); }
.kd-count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--kd-blue); background: #dce9ff; padding: 6px 12px; border-radius: 999px; }
.kd-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; align-items: start; }
.kd-card { background: #fff; border: 2px solid rgba(0, 74, 198, .12); border-radius: 22px; padding: 16px; box-shadow: 0 8px 24px -12px rgba(11, 28, 48, .18); }
.kd-stage-card { padding: 10px; background: #fff; }
.kd-stage { position: relative; width: 100%; user-select: none; touch-action: manipulation; }
.kd-pic { position: absolute; }
.kd-pic img, .kd-pic svg { width: 100%; height: 100%; display: block; object-fit: contain; filter: drop-shadow(0 10px 18px rgba(11, 28, 48, .12)); pointer-events: none; }
.kd-missing { width: 100%; height: 100%; border: 2px dashed #c3c6d7; border-radius: 18px; display: grid; place-content: center; gap: 8px; text-align: center; padding: 16px; background: #f8f9ff; color: #434655; font-size: 14px; }
.kd-missing code { display: block; background: #fff; padding: 4px 8px; border-radius: 6px; margin-top: 4px; font-size: 12px; word-break: break-all; }
.kd-lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.kd-ln { stroke: #90a4ae; stroke-width: 1.4; stroke-dasharray: 4 4; fill: none; transition: stroke .2s, stroke-width .2s; }
.kd-ln.on { stroke: var(--kd-blue); stroke-width: 2.4; stroke-dasharray: none; }
.kd-ln.good { stroke: #059669; stroke-width: 2.4; stroke-dasharray: none; }
.kd-dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--kd-blue); border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0, 74, 198, .4), 0 2px 6px rgba(11, 28, 48, .3); cursor: pointer; padding: 0; z-index: 2; font: 700 10px/1 Inter, sans-serif; color: #fff; }
.kd-dot:hover { transform: scale(1.25); }
.kd-dot.on { background: var(--kd-orange); animation: kd-pulse 1.4s infinite ease-in-out; z-index: 3; }
.kd-dot.good { background: #059669; }
.kd-dot.bad, .kd-chip.bad { animation: kd-shake .35s; background: #e11d48; }
@keyframes kd-pulse { 0%, 100% { box-shadow: 0 0 0 1px rgba(0, 74, 198, .4), 0 0 0 0 rgba(254, 147, 44, .6); } 50% { box-shadow: 0 0 0 1px rgba(0, 74, 198, .4), 0 0 0 9px rgba(254, 147, 44, 0); } }
@keyframes kd-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.kd-chip { position: absolute; height: 30px; display: inline-flex; align-items: center; gap: 5px; padding: 0 12px; border-radius: 999px; background: #fff; border: 1px solid #c3c6d7; box-shadow: 0 2px 6px rgba(11, 28, 48, .1); font: 700 12.5px/1 Inter, "Noto Sans Sinhala", sans-serif; color: #0b1c30; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 2; transition: transform .15s, background .15s; }
.kd-chip span:last-child { overflow: hidden; text-overflow: ellipsis; }
.kd-chip:hover { border-color: var(--kd-blue); transform: scale(1.04); }
.kd-chip.on { background: var(--kd-blue); color: #fff; border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(0, 74, 198, .4), 0 6px 14px rgba(0, 74, 198, .3); }
.kd-chip.good { background: #059669; color: #fff; border-color: #059669; }
.kd-emo { font-size: 14px; }
.kd-stage.is-phone .kd-dot { width: 22px; height: 22px; margin: -11px 0 0 -11px; border-width: 2px; }
.kd-side { display: grid; gap: 14px; position: sticky; top: 12px; }
.kd-hello, .kd-quiz { text-align: center; display: grid; gap: 8px; justify-items: center; padding: 8px 4px; }
.kd-hello h2, .kd-quiz h2 { margin: 0; font-size: 22px; font-weight: 800; }
.kd-hello p, .kd-quiz p { margin: 0; color: #434655; font-size: 15px; line-height: 1.6; }
.kd-quiz h2 span { color: var(--kd-blue); }
.kd-big { width: 72px; height: 72px; border-radius: 20px; background: #dbe1ff; display: grid; place-items: center; font-size: 42px; flex-shrink: 0; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .06); }
.kd-num { font: 800 30px/1 Inter, sans-serif; color: var(--kd-blue); }
.kd-head { display: flex; align-items: center; gap: 14px; }
.kd-head h2 { margin: 0; font-size: clamp(24px, 3.6vw, 32px); font-weight: 800; line-height: 1.2; }
.kd-say, .kd-btn { border: 0; background: var(--kd-blue); color: #fff; font: 700 14px/1 Inter, "Noto Sans Sinhala", sans-serif; padding: 12px 16px; border-radius: 16px; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 74, 198, .3); white-space: nowrap; }
.kd-head .kd-say { margin-left: auto; }
.kd-say:hover, .kd-btn:hover { background: #2563eb; }
.kd-desc { margin: 12px 0 0; font-size: 16px; font-weight: 600; line-height: 1.7; background: #eff4ff; border: 1px solid #c3c6d7; border-radius: 16px; padding: 14px; }
.kd-act { margin-top: 10px; background: rgba(255, 220, 195, .5); border: 1px solid #ffdcc3; border-radius: 16px; padding: 12px 14px; display: grid; gap: 3px; }
.kd-act b { font-size: 12px; color: #904d00; text-transform: uppercase; letter-spacing: .04em; }
.kd-act span { font-size: 15px; font-weight: 700; color: #2f1500; }
.kd-qn { font-size: 13px !important; font-weight: 700; color: var(--kd-blue) !important; }
.kd-msg { min-height: 24px; font-weight: 800; }
.kd-msg.ok { color: #059669 !important; } .kd-msg.no { color: #e11d48 !important; }
.kd-stars { font-size: 30px !important; letter-spacing: 3px; }
.kd-list h3 { margin: 0 0 10px; font-size: 15px; font-weight: 800; }
.kd-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.kd-parts button { display: flex; align-items: center; gap: 7px; padding: 9px 10px; border-radius: 12px; border: 1px solid #c3c6d7; background: #eff4ff; font: 700 13px/1.25 Inter, "Noto Sans Sinhala", sans-serif; color: #0b1c30; cursor: pointer; text-align: left; }
.kd-parts button:hover { border-color: var(--kd-blue); background: #dce9ff; }
.kd-parts button.on { background: var(--kd-blue); color: #fff; border-color: var(--kd-blue); }
.kd-parts button.seen:not(.on) .kd-n { background: #059669; color: #fff; }
.kd-n { min-width: 22px; height: 22px; border-radius: 999px; background: #fff; border: 1px solid #c3c6d7; display: inline-grid; place-items: center; font: 800 11px/1 Inter, sans-serif; color: #434655; flex-shrink: 0; }
.kd-parts button.on .kd-n { background: #fff; color: var(--kd-blue); }
@media (max-width: 900px) { .kd-grid { grid-template-columns: 1fr; } .kd-side { position: static; } }
@media (prefers-reduced-motion: reduce) { .kd-dot.on, .kd-dot.bad, .kd-chip.bad { animation: none; } }

/* ---------- full screen for every knowledge topic ---------- */
.k-fs-wrap { position: relative; }
.k-fs-wrap:fullscreen { background: #f8f9ff; overflow: auto; padding: 16px; }
.k-fs-wrap:fullscreen iframe { height: calc(100vh - 32px) !important; }
.k-fs-wrap.is-fs { position: fixed; inset: 0; z-index: 200; background: #f8f9ff; overflow: auto; padding: 12px; }
.k-fs-wrap.is-fs iframe { height: calc(100vh - 24px) !important; }
.k-fs-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; border: 1px solid #cbd5e1; background: #fff; font: 700 14px/1 Inter, "Noto Sans Sinhala", sans-serif; color: #334155; cursor: pointer; }
.k-fs-btn:hover { border-color: #004ac6; color: #004ac6; }
.k-fs-close { position: fixed; top: 12px; right: 12px; z-index: 210; display: none; }
.k-fs-wrap:fullscreen .k-fs-close, .k-fs-wrap.is-fs .k-fs-close { display: inline-flex; }
/* v3.5: language and picture size */
.kd-langs button { font-size: 13px; padding: 8px 12px; }
.kd-size { align-items: center; }
.kd-size button { padding: 8px 10px; font-size: 13px; }
.kd-size-n { font: 800 12px/1 Inter, sans-serif; color: #004ac6; min-width: 34px; text-align: center; }
.kd.is-wide .kd-grid { grid-template-columns: 1fr; }
.kd.is-wide .kd-side { position: static; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .kd.is-wide .kd-side { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .kd-top { gap: 6px; } .kd-count { margin-left: 0; } }

/* ---------- v3.6: Clock ---------- */
.clk-stage { display: grid; justify-items: center; gap: 6px; }
#clk-svg { width: min(100%, 560px); height: auto; touch-action: none; user-select: none; cursor: grab; }
.clk-n { font: 800 34px/1 Inter, sans-serif; fill: #0f172a; }
.clk-m { font: 700 12px/1 Inter, sans-serif; fill: #64748b; }
.clk-24 { display: none; font: 700 15px/1 Inter, sans-serif; fill: #7c3aed; }
#clk-svg.is-24 .clk-24 { display: inline; }
.clk-grab { cursor: grab; }
.clk-tip { margin: 0; font-size: 13px; color: #64748b; text-align: center; }
.clk-24t { display: inline-flex; align-items: center; gap: 6px; font: 700 13px/1 Inter, "Noto Sans Sinhala", sans-serif; color: #334155; background: #fff; border: 1px solid #c3c6d7; border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.clk-now { display: flex; align-items: center; gap: 14px; }
.clk-sky { font-size: 44px; }
.clk-dig { font: 800 44px/1.1 ui-monospace, "SFMono-Regular", Menlo, monospace; color: #1d4ed8; letter-spacing: .02em; }
.clk-dig small { font-size: 18px; color: #64748b; }
.clk-dig.sm { font-size: 26px; margin: 0; }
.clk-words { font-size: 22px; font-weight: 800; color: #0b1c30; margin-top: 4px; line-height: 1.3; }
.clk-day { font-size: 14px; font-weight: 700; color: #904d00; }
.clk-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; justify-content: center; }
.clk-ghost { background: #fff !important; color: #004ac6 !important; border: 1px solid #c3c6d7 !important; box-shadow: none !important; }
.clk-step { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; font-weight: 700; color: #434655; }
.clk-step button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid #c3c6d7; background: #eff4ff; font-size: 18px; font-weight: 800; cursor: pointer; }
.clk-step span { margin-left: 6px; }
.clk-facts { margin: 14px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; color: #334155; line-height: 1.55; }
.clk-level h3 { margin: 0 0 8px; font-size: 14px; font-weight: 800; }
.clk-lv { display: flex; flex-wrap: wrap; gap: 6px; }
.clk-lv button { border: 1px solid #c3c6d7; background: #eff4ff; border-radius: 999px; padding: 7px 12px; font: 700 13px/1 Inter, "Noto Sans Sinhala", sans-serif; cursor: pointer; }
.clk-lv button.on { background: #004ac6; color: #fff; border-color: #004ac6; }
.clk-opts { display: grid; gap: 8px; width: 100%; margin-top: 6px; }
.clk-opts button { display: grid; gap: 2px; text-align: left; border: 1px solid #c3c6d7; background: #fff; border-radius: 14px; padding: 12px 14px; font: 700 16px/1.3 Inter, "Noto Sans Sinhala", sans-serif; cursor: pointer; color: #0b1c30; }
.clk-opts button small { font: 600 12px/1 ui-monospace, monospace; color: #64748b; }
.clk-opts button:hover { border-color: #004ac6; }
.clk-opts button.good { background: #d1fae5; border-color: #059669; }
.clk-opts button.bad { background: #ffe4e6; border-color: #e11d48; animation: kd-shake .35s; }

/* ---------- v3.6: Pulleys ---------- */
.pl-types { display: flex; flex-wrap: wrap; gap: 8px; }
.pl-types button { border: 1px solid #c3c6d7; background: #fff; border-radius: 14px; padding: 10px 14px; font: 700 13.5px/1.2 Inter, "Noto Sans Sinhala", sans-serif; cursor: pointer; color: #0b1c30; }
.pl-types button.on { background: #904d00; border-color: #904d00; color: #fff; box-shadow: 0 4px 12px rgba(144, 77, 0, .3); }
.pl-stage-card { display: grid; gap: 10px; }
.pl-ctrl { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; }
.pl-ctrl label { display: grid; gap: 4px; font: 700 12.5px/1.2 Inter, "Noto Sans Sinhala", sans-serif; color: #334155; min-width: 150px; }
.pl-ctrl label b { color: #004ac6; }
.pl-ctrl select { font: inherit; padding: 7px 10px; border: 1px solid #c3c6d7; border-radius: 10px; background: #fff; }
.pl-ctrl input[type=range], .pl-pull input[type=range] { accent-color: #f97316; }
.pl-svg { width: 100%; height: auto; max-height: 78vh; background: linear-gradient(#fff, #fffbeb); border-radius: 16px; touch-action: none; }
.pl-handle { cursor: ns-resize; }
.pl-f { font: 800 16px/1 Inter, sans-serif; fill: #c2410c; }
.pl-lt { font: 800 17px/1 Inter, sans-serif; fill: #fff; }
.pl-ls { font: 600 12px/1 Inter, sans-serif; fill: #cbd5e1; }
.pl-pull { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pl-pull input { flex: 1 1 200px; }
.pl-h { margin: 0; font-size: 22px; font-weight: 800; }
.pl-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.pl-stats > div { background: #f8f9ff; border: 1px solid #dce9ff; border-radius: 12px; padding: 9px 11px; display: grid; gap: 3px; }
.pl-stats span { font-size: 11.5px; font-weight: 700; color: #434655; }
.pl-stats b { font: 800 17px/1.2 Inter, sans-serif; color: #0b1c30; }
.pl-stats .pl-big { background: #eff4ff; border-color: #b4c5ff; }
.pl-stats .pl-big b { font-size: 28px; color: #004ac6; }
.pl-seg { margin: 10px 0 0; font-weight: 700; color: #904d00; }
.pl-qs { font-size: 12px !important; font-weight: 700; color: #904d00 !important; }
.pl-svg { display: block; margin: 0 auto; max-width: 100%; }
.pl.is-quiz .pl-ctrl, .pl.is-quiz .pl-pull, .pl.is-quiz .pl-stage-card > .clk-tip { display: none; }
.pl.is-quiz .pl-types { opacity: .55; }
