/* ELECNora+ — the review test (elecplus/labtest.js). Variant A takes the theme's primary colour, variant B its
   opposite on the colour wheel (relative colour syntax, with a fixed fallback), so the two never clash in any theme.
   Right = blue, wrong = red, as the owner asked. */
.lt-launch, .lt-run { --lt-a: var(--primary, #2f6fd6); --lt-b: #d9822b; --lt-ok: #2f6fd6; --lt-bad: #d64545; --lt-mid: #c99a1a; }
@supports (color: hsl(from red h s l)) { .lt-launch, .lt-run { --lt-b: hsl(from var(--lt-a) calc(h + 180) s l); } }
:root[data-theme="dark"] :is(.lt-launch, .lt-run) { --lt-ok: #6aa5ff; --lt-bad: #ff7474; --lt-mid: #e6bf4f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.lt-launch, .lt-run) { --lt-ok: #6aa5ff; --lt-bad: #ff7474; --lt-mid: #e6bf4f; } }

.lt-head { margin-bottom: 14px; }
.lt-head h3 { margin: 4px 0; font-size: 1.3rem; }
.lt-head p { margin: 0; color: var(--muted); }
.lt-tag { font: 700 max(12px, 0.74rem)/1 "JetBrains Mono", ui-monospace, monospace; letter-spacing: 0.08em; text-transform: uppercase; color: var(--lt-a); }

/* three level cards: one hue, three depths (light → dark = easy → hard) */
.lt-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.lt-card { --c: color-mix(in srgb, var(--lt-a) 30%, var(--surface)); display: flex; flex-direction: column; gap: 8px; min-height: 140px; padding: 16px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.lt-c1 { --c: color-mix(in srgb, var(--lt-a) 60%, var(--surface)); } .lt-c2 { --c: var(--lt-a); }
.lt-card { box-shadow: inset 0 5px 0 var(--c); }
.lt-card:hover, .lt-card:focus-visible { transform: translateY(-2px); border-color: var(--c); outline: none; box-shadow: inset 0 5px 0 var(--c), 0 12px 26px -16px var(--c); }
.lt-card[aria-pressed="true"] { border-color: var(--c); box-shadow: inset 0 5px 0 var(--c), 0 0 0 2px var(--c); }
.lt-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.lt-card-top b { font-size: 1.15rem; }
.lt-card-top small { color: var(--muted); font-weight: 700; }
.lt-dots { color: var(--lt-a); letter-spacing: 3px; font-size: 0.8rem; }
.lt-card-line { color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

/* the set-up */
.lt-setup { margin-top: 16px; padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.lt-intro { margin: 0 0 16px; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--lt-a) 9%, transparent); line-height: 1.6; }
.lt-row { display: grid; grid-template-columns: 9rem minmax(0, 1fr); align-items: center; gap: 10px; margin-bottom: 16px; }
.lt-label { font-weight: 800; }
.lt-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.lt-seg button { min-height: 40px; padding: 6px 14px; border: 0; border-radius: 10px; background: none; color: var(--text); font: 700 0.9rem var(--font-ui); cursor: pointer; }
.lt-seg button.is-on { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); color: var(--lt-a); }
.lt-vars { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 440px; }
.lt-var { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); cursor: pointer; text-align: left; }
.lt-var b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; font-size: 1.05rem; }
/* the letter's colour (black or white) is the one that reads on the variant colour of this theme (labtest.js ltTune) */
.lt-var-A b { background: var(--lt-a); color: var(--lt-on-a, #fff); } .lt-var-B b { background: var(--lt-b); color: var(--lt-on-b, #fff); }
.lt-var small { color: var(--muted); font-size: 0.78rem; line-height: 1.3; }
.lt-var-A.is-on { border-color: var(--lt-a); } .lt-var-B.is-on { border-color: var(--lt-b); }

/* how many questions: a number line, minimal, the chosen part filled */
.lt-row-count { align-items: start; }
.lt-count-now { color: var(--lt-a); font: 800 1.3rem/1 "JetBrains Mono", ui-monospace, monospace; }
.lt-line { position: relative; padding: 6px 12px 26px; }
.lt-line input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; margin: 10px 0; border-radius: 3px; cursor: pointer;
  background: linear-gradient(to right, var(--lt-a) calc(var(--i) / max(var(--n), 1) * 100%), var(--surface-2) 0); }
.lt-line input::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border: 3px solid var(--surface); border-radius: 50%; background: var(--lt-a); box-shadow: 0 0 0 1px var(--lt-a), 0 4px 10px -2px var(--lt-a); }
.lt-line input::-moz-range-thumb { width: 18px; height: 18px; border: 3px solid var(--surface); border-radius: 50%; background: var(--lt-a); }
.lt-line input:focus-visible { outline: 2px solid var(--lt-a); outline-offset: 6px; }
.lt-ticks { position: absolute; left: 12px; right: 12px; bottom: 0; height: 20px; }
.lt-ticks span { position: absolute; left: calc(var(--x) * 100%); transform: translateX(-50%); color: var(--muted); font: 600 0.78rem "JetBrains Mono", ui-monospace, monospace; }
.lt-ticks span::before { content: ""; position: absolute; left: 50%; top: -14px; width: 2px; height: 8px; background: var(--border); }
.lt-ticks span.is-in { color: var(--text); } .lt-ticks span.is-in::before { background: var(--lt-a); }

/* three switches */
.lt-switches { display: grid; gap: 10px; }
.lt-switch { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.lt-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lt-track { position: relative; flex: none; width: 46px; height: 26px; border-radius: 13px; background: var(--border); transition: background 0.2s; }
.lt-track i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s; }
.lt-switch input:checked + .lt-track { background: var(--lt-a); }
.lt-switch input:checked + .lt-track i { transform: translateX(20px); }
.lt-switch input:focus-visible + .lt-track { outline: 2px solid var(--lt-a); outline-offset: 2px; }
.lt-switch span:last-child { display: grid; gap: 2px; }
.lt-switch small, .lt-mode small { color: var(--muted); font-size: 0.82rem; }
.lt-mode { display: grid; gap: 6px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); }
.lt-go { margin: 16px 0 0; }

/* the running test */
.lt-run { position: relative; }
.lt-run[data-mode="minimal"] { position: fixed; inset: 0; z-index: 2147483000; overflow: auto; background: var(--surface); color: var(--text); }
.lt-frame { position: relative; max-width: 860px; margin: 0 auto; padding: 16px; }
.lt-run[data-mode="minimal"] .lt-frame { padding-top: 24px; }
body[data-page="elec-labtest"] .lt-frame { margin: 20px auto 40px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.lt-bar { display: flex; align-items: center; gap: 10px; }
.lt-pill { padding: 5px 12px; border-radius: 999px; color: #fff; font-weight: 800; font-size: 0.85rem; }
.lt-pill.lt-var-A { background: var(--lt-a); color: var(--lt-on-a, #fff); } .lt-pill.lt-var-B { background: var(--lt-b); color: var(--lt-on-b, #fff); }
.lt-prog { color: var(--muted); font-weight: 700; }
.lt-clock { margin-left: auto; font: 800 1.25rem "JetBrains Mono", ui-monospace, monospace; }
.lt-clock.is-low { color: var(--lt-bad); }
.lt-result .lt-bar .lt-x { margin-left: auto; }
.lt-x { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); font-size: 1.1rem; cursor: pointer; }
.lt-timebar { height: 6px; margin: 12px 0 18px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.lt-timebar i { display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--lt-a); transition: width 0.25s linear; }
.lt-q { padding: 22px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.lt-qn { margin: 0 0 4px; color: var(--muted); font: 700 0.85rem "JetBrains Mono", ui-monospace, monospace; }
.lt-qt { margin: 0 0 18px; font-size: clamp(1.05rem, 2.6vw, 1.35rem); line-height: 1.45; }
.lt-opts { display: grid; gap: 10px; }
.lt-opt { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); font: 600 1rem/1.4 var(--font-ui); text-align: left; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.lt-opt:hover:not(:disabled), .lt-opt:focus-visible { border-color: var(--lt-a); outline: none; }
.lt-key { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); font: 800 0.85rem "JetBrains Mono", ui-monospace, monospace; }
.lt-opt.is-right { border-color: var(--lt-ok); background: color-mix(in srgb, var(--lt-ok) 15%, var(--surface)); }
.lt-opt.is-wrong { border-color: var(--lt-bad); background: color-mix(in srgb, var(--lt-bad) 15%, var(--surface)); }
.lt-numf { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.lt-numbox { flex: 1 1 12rem; display: grid; gap: 4px; min-width: 0; }
.lt-eq { min-height: 1.1em; padding-left: 14px; color: var(--muted); font: 700 0.85rem "JetBrains Mono", ui-monospace, monospace; }
.lt-eq.is-bad { color: var(--lt-bad); }
/* the unit-prefix pad: a segmented strip beside the box; the plain unit is marked by a thin divider on each side */
.lt-pfx { display: inline-flex; flex-wrap: wrap; align-self: flex-start; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.lt-pfx button { min-width: 44px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: 700 0.85rem "JetBrains Mono", ui-monospace, monospace; cursor: pointer; transition: background 0.15s, color 0.15s; }
.lt-pfx button.is-base { box-shadow: inset 1px 0 var(--border), inset -1px 0 var(--border); border-radius: 0; }
.lt-pfx button:hover { color: var(--text); background: var(--surface); }
.lt-pfx button[aria-checked="true"] { background: var(--lt-a); color: var(--lt-on-a, #fff); border-radius: 9px; box-shadow: none; }
.lt-pfx button:focus-visible { outline: 2px solid var(--lt-a); outline-offset: 1px; }
.lt-numf > .btn { align-self: flex-start; min-height: 52px; }
/* the hint: a quiet line above the footer, opened by «💡 Сануулга» */
.lt-hint { display: flex; gap: 10px; align-items: baseline; margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; border-left: 4px solid var(--lt-mid); background: color-mix(in srgb, var(--lt-mid) 12%, transparent); line-height: 1.5; font-weight: 600; }
.lt-foot-l { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.lt-hintbtn:hover { color: var(--lt-mid); border-color: var(--lt-mid); }
.lt-hintbtn[aria-expanded="true"] { border-style: solid; color: var(--text); }
@media (max-width: 640px) { .lt-pfx { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; } .lt-pfx button { min-width: 0; padding: 0 4px; } .lt-numf > .btn { width: 100%; } }
.lt-num { width: 100%; min-height: 52px; padding: 8px 14px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); font: 700 1.2rem "JetBrains Mono", ui-monospace, monospace; }
.lt-num:focus-visible { border-color: var(--lt-a); outline: none; }
.lt-unit { font-weight: 800; color: var(--muted); }
.lt-fb { margin: 16px 0 0; padding: 10px 14px; border-radius: 12px; line-height: 1.55; }
.lt-fb.is-right { background: color-mix(in srgb, var(--lt-ok) 14%, transparent); border-left: 4px solid var(--lt-ok); }
.lt-fb.is-wrong { background: color-mix(in srgb, var(--lt-bad) 14%, transparent); border-left: 4px solid var(--lt-bad); }
.lt-frame.flash-right .lt-q { box-shadow: 0 0 0 3px var(--lt-ok); } .lt-frame.flash-wrong .lt-q { box-shadow: 0 0 0 3px var(--lt-bad); }
.lt-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.lt-report { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 12px; border: 1px dashed var(--border); border-radius: 12px; background: none; color: var(--muted); font: 700 0.88rem var(--font-ui); cursor: pointer; }
.lt-report:hover { color: var(--lt-bad); border-color: var(--lt-bad); }
.lt-mark { position: fixed; inset: 0; z-index: 1; pointer-events: none; display: grid; place-items: center; color: var(--text); opacity: 0.06; font: 800 clamp(1rem, 4vw, 2rem) var(--font-ui); transform: rotate(-24deg); white-space: nowrap; }

/* dialogs: report, leave */
.lt-modal { position: fixed; inset: 0; z-index: 2147483100; display: grid; place-items: center; padding: 16px; background: rgba(10, 14, 22, 0.55); backdrop-filter: blur(4px); }
.lt-dialog { position: relative; width: min(100%, 460px); padding: 20px; border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.5); }
.lt-dialog h3 { margin: 0 0 6px; }
.lt-paused { margin: 0 0 12px; color: var(--muted); font-weight: 700; }
.lt-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.lt-kinds label { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.lt-kinds label:has(input:checked) { border-color: var(--lt-a); background: color-mix(in srgb, var(--lt-a) 10%, transparent); }
.lt-reptext { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); font: inherit; resize: vertical; }
.lt-repcount { margin: 4px 0 0; color: var(--muted); font-size: 0.8rem; text-align: right; } .lt-repcount.is-ok { color: var(--lt-ok); }
.lt-dialog-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 14px 0 0; }
.lt-leave { display: flex; gap: 16px; align-items: center; width: min(100%, 520px); background: linear-gradient(135deg, color-mix(in srgb, var(--lt-a) 92%, #000), color-mix(in srgb, var(--lt-b) 70%, var(--lt-a))); color: #fff; }
.lt-leave .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, 0.7); }
.lt-leave-art { flex: none; font-size: 3.2rem; transform: rotate(-12deg); }
.lt-x-in { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; background: rgba(255, 255, 255, 0.18); color: #fff; border-color: transparent; }

/* the result */
.lt-score { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin: 16px 0; }
.lt-score h2 { margin: 0 0 4px; } .lt-score p { margin: 0 0 4px; }
.lt-ring { display: grid; place-items: center; width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(var(--lt-a) calc(var(--p) * 1%), var(--surface-2) 0); }
.lt-ring b { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; background: var(--surface); font: 800 1.5rem "JetBrains Mono", ui-monospace, monospace; }
.lt-fbline { font-weight: 700; } .lt-saved { color: var(--muted); font-size: 0.85rem; }
.lt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.lt-grid figure { margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.lt-grid figcaption { margin-bottom: 8px; font-weight: 800; }
.lt-chart { display: block; width: 100%; height: auto; }
.lt-chart .lt-ok { fill: var(--lt-ok); } .lt-chart .lt-bad { fill: var(--lt-bad); } .lt-chart .lt-skip { fill: var(--border); }
.lt-chart .lt-line { fill: none; stroke: var(--lt-a); stroke-width: 3; stroke-linejoin: round; }
.lt-ax { fill: var(--muted); font: 600 10px Inter, system-ui, sans-serif; }
.lt-hbars p { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) 3rem; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 0.86rem; }
.lt-hbars i { display: block; height: 12px; border-radius: 6px; background: linear-gradient(to right, var(--bar) calc(var(--p) * 1%), var(--surface-2) 0); }
.lt-hbars i.lt-ok { --bar: var(--lt-ok); } .lt-hbars i.lt-mid { --bar: var(--lt-mid); } .lt-hbars i.lt-bad { --bar: var(--lt-bad); }
.lt-note { margin: 6px 0 0; color: var(--muted); font-size: 0.84rem; }
.lt-words h3 { margin: 18px 0 8px; font-size: 1rem; }
.lt-tops, .lt-kw { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.lt-top { padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: 0.86rem; }
.lt-top.lt-ok { background: color-mix(in srgb, var(--lt-ok) 16%, transparent); color: var(--lt-ok); }
.lt-top.lt-mid { background: color-mix(in srgb, var(--lt-mid) 18%, transparent); color: var(--lt-mid); }
.lt-top.lt-bad { background: color-mix(in srgb, var(--lt-bad) 16%, transparent); color: var(--lt-bad); }
.lt-review { margin-top: 18px; border: 1px solid var(--border); border-radius: 14px; }
.lt-review summary { min-height: 44px; padding: 10px 14px; font-weight: 800; cursor: pointer; }
.lt-review ol { margin: 0; padding: 0 14px 14px 2.2em; }
.lt-review li { margin-bottom: 12px; padding-left: 6px; border-left: 3px solid var(--border); }
.lt-review li.lt-ok { border-left-color: var(--lt-ok); } .lt-review li.lt-bad { border-left-color: var(--lt-bad); }
.lt-review p { margin: 2px 0; } .lt-why { color: var(--muted); font-size: 0.88rem; }

/* minimal mode: nothing of the site, nothing to copy, nothing to print */
html.lt-secure body > *:not(#ltRun):not(.toast-wrap):not(#toast) { display: none !important; }
html.lt-secure, html.lt-secure body { overflow: hidden; background: var(--surface); }
html.lt-secure .lt-run { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.lt-veiled .lt-run .lt-q, html.lt-blank .lt-run .lt-q { filter: blur(18px); }
html.lt-blank .lt-run::after { content: ""; position: fixed; inset: 0; z-index: 3; background: #000; }
@media print { html.lt-secure body * { display: none !important; } }
@media (max-width: 640px) {
  .lt-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .lt-frame { padding: 12px; } .lt-q { padding: 16px; }
  .lt-kinds { grid-template-columns: minmax(0, 1fr); }
  .lt-leave { flex-direction: column; text-align: center; } .lt-leave .lt-dialog-btns { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .lt-card, .lt-track, .lt-track i, .lt-timebar i, .lt-opt { transition: none; } }
:root[data-gfx="low"] .lt-modal { backdrop-filter: none; }
