/* JEEVisionX explorer theme: light (house look) and dark, switched by the button in the top bar
   (data-ex-theme on <html>; its own attribute, so a host page's data-theme never interferes). */
:root {
  --ink: #1B1B2F; --ink2: #4A4A63; --page: #FFFFFF; --panel: #F7F7FB; --line: #E2E2EC;
  --purple: #7C00FF; --tint: #F4EEFF; --good: #0B8A42; --bad: #D7263D;
  --axes: #B6B6C8; --grid: #ECECF3; --ghost: #9A9AAE;
  --z: #0066FF; --mod: #E67E00; --arg: #00838F; --alpha: #9A9AAE; --calc: #D7263D; --neutral: #B6B6C8;
  --ro-base: 18px;
}
:root[data-ex-theme="dark"] {
  --ink: #E9E9F2; --ink2: #B4B4C8; --page: #14141F; --panel: #1C1C2B; --line: #303047;
  --purple: #B57BFF; --tint: #261B3D; --good: #3DCB7A; --bad: #FF5C70;
  --axes: #66667E; --grid: #29293C; --ghost: #8C8CA4;
  --z: #5B9DFF; --mod: #FF9A2E; --arg: #2EC0CC; --alpha: #9A9AB4; --calc: #FF5C70; --neutral: #6E6E88;
  color-scheme: dark;
}
html, body { height: 100%; margin: 0; overflow: hidden; }
.ex-page { margin: 0; background: var(--page); color: var(--ink); font-family: "Open Sans", system-ui, sans-serif; }

#explore-app { font-family: "Open Sans", system-ui, sans-serif; color: var(--ink); background: var(--page); height: 100vh; height: 100dvh;
  overflow: hidden; box-sizing: border-box; }
#explore-app *, #explore-app *::before, #explore-app *::after { box-sizing: border-box; }
#explore-app .katex { font-size: 1.08em; }

/* the app shell: one window, the page never scrolls, everything on screen at once */
.ex { position: relative; display: flex; flex-direction: column; height: 100%; min-width: 0; }
.ex-top { flex: none; height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.ex-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding-right: 8px; color: var(--purple);
  font-weight: 600; font-size: 16px; text-decoration: none; white-space: nowrap; }
.ex-back:focus-visible { outline: 3px solid var(--purple); outline-offset: -3px; border-radius: 6px; }
.ex-h1 { margin: 0; font-size: 16px; font-weight: 600; color: var(--ink2); min-width: 0;
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.ex-wide .ex-h1 { position: static; width: auto; height: auto; clip: auto; clip-path: none; overflow: hidden; text-overflow: ellipsis; }
.ex-theme { margin-left: auto; flex: none; width: 40px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--line); background: var(--page); color: var(--ink2); cursor: pointer; }
.ex-theme:hover { border-color: var(--purple); color: var(--purple); }
.ex-theme:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.ex-reset { flex: none; min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--purple);
  background: var(--page); color: var(--purple); font: 600 15px "Open Sans", system-ui, sans-serif; cursor: pointer; }
.ex-reset:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.ex-main { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 8px 12px 10px; }
.ex-formula { flex: none; background: var(--tint); border-radius: 10px; padding: 6px 12px; font-size: 17px; line-height: 1.5; }
.ex-formula-part { white-space: nowrap; }
.ex-formula .katex { white-space: nowrap; }
.ex-plane { flex: none; width: var(--plane, 300px); height: var(--plane, 300px); margin: 0 auto; min-width: 0; }
.ex-values { flex: none; background: var(--page); border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; min-width: 0; }
.ex-controls { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; min-width: 0; }
.ex-block { min-width: 0; background: var(--panel); border: 2px solid var(--line); border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.ex-block.active { border-color: var(--purple); background: var(--tint); cursor: default; }
.ex-block-title { font-size: 15px; font-weight: 700; color: var(--ink2); line-height: 1.3; margin-bottom: 2px; }
.ex-block.active .ex-block-title { color: var(--purple); }
.ex-probe { position: absolute; left: -9999px; top: 0; visibility: hidden; }
.ex-wide .ex-main { display: grid; grid-template-columns: var(--plane, 300px) minmax(0, 1fr);
  grid-template-rows: auto auto auto 1fr; gap: 10px 16px; align-content: start; }
.ex-wide .ex-plane { grid-column: 1; grid-row: 1 / 5; margin: 0; }
.ex-wide .ex-formula { grid-column: 2; grid-row: 1; }
.ex-wide .ex-values { grid-column: 2; grid-row: 2; }
.ex-wide .ex-controls { grid-column: 2; grid-row: 3; }

.plane { position: relative; width: 100%; background: var(--page); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.plane svg { display: block; font-family: "Open Sans", system-ui, sans-serif; }
.plane-labels, .plane-handles { position: absolute; inset: 0; pointer-events: none; }
.plane-label { position: absolute; white-space: nowrap; font-size: 17px; line-height: 1.2; }
.plane-label .katex { font-size: 1em; }
.ex-grab { position: absolute; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; pointer-events: auto;
  touch-action: none; cursor: grab; outline: none; }
.ex-grab:focus-visible { box-shadow: 0 0 0 3px var(--tint), 0 0 0 5px var(--purple); }
.ex-grab.dragging { cursor: grabbing; }

/* The plane's shapes carry their light colours as SVG attributes (the tests read them); these rules
   give each one its theme colour, so the dark theme changes them all. */
.plane [stroke="#ECECF3"] { stroke: var(--grid); }
.plane [stroke="#B6B6C8"] { stroke: var(--axes); }
.plane [fill="#B6B6C8"] { fill: var(--axes); }
.plane [fill="#4A4A63"] { fill: var(--ink2); }
.plane [stroke="#1B1B2F"] { stroke: var(--ink); }
.plane [fill="#1B1B2F"] { fill: var(--ink); }
.plane [stroke="#9A9AAE"] { stroke: var(--ghost); }
.plane [fill="#9A9AAE"] { fill: var(--ghost); }
.plane [stroke="#0066FF"] { stroke: var(--z); }
.plane [fill="#0066FF"] { fill: var(--z); }
.plane [stroke="#E67E00"] { stroke: var(--mod); }
.plane [stroke="#00838F"] { stroke: var(--arg); }
.plane [stroke="#D7263D"] { stroke: var(--calc); }
.plane [fill="#D7263D"] { fill: var(--calc); }
.plane-label[data-c="#1B1B2F"] { color: var(--ink) !important; }
.plane-label[data-c="#4A4A63"] { color: var(--ink2) !important; }
.plane-label[data-c="#9A9AAE"] { color: var(--alpha) !important; }
.plane-label[data-c="#0066FF"] { color: var(--z) !important; }
.plane-label[data-c="#E67E00"] { color: var(--mod) !important; }
.plane-label[data-c="#00838F"] { color: var(--arg) !important; }
.plane-label[data-c="#D7263D"] { color: var(--calc) !important; }

input:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.ex-slider { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 18px; }
.ex-slider-label { width: 1.2em; flex: none; text-align: center; }
.ex-slider-value { flex: none; min-width: 3.4em; text-align: left; }
.ex-slider input[type=range] { flex: 1; min-width: 0; height: 44px; margin: 0; accent-color: var(--purple); }
.ex-check { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 15px; line-height: 1.3; cursor: pointer; }
.ex-check input { width: 22px; height: 22px; accent-color: var(--purple); margin: 0; flex: none; }
/* the length-and-angle sliders and values in the colours of the modulus and the argument */
.ex-slider.role-mod input[type=range] { accent-color: var(--mod); }
.ex-slider.role-arg input[type=range] { accent-color: var(--arg); }
.ex-slider.role-mod .ex-slider-label, .ex-slider.role-mod .ex-slider-value { color: var(--mod); }
.ex-slider.role-arg .ex-slider-label, .ex-slider.role-arg .ex-slider-value { color: var(--arg); }

/* the values: every row on a light wash of its own colour; the two results (modulus, argument) boxed */
.ex-readout { --ro-fs: var(--ro-size, var(--ro-base)); display: flow-root; }   /* flow-root: the rows' margins count in its height */
.ro-row { --rc: var(--line); border-left: 4px solid var(--rc); background: color-mix(in srgb, var(--rc) 8%, var(--page));
  border-radius: 0 8px 8px 0; padding: 3px 12px; margin: 6px 0; min-width: 0; overflow-wrap: anywhere; }
.ro-row.ro-main { border: 2px solid var(--rc); border-left-width: 6px; border-radius: 8px; padding: 4px 12px;
  background: color-mix(in srgb, var(--rc) 14%, var(--page)); }
.ro-line { line-height: 1.4; font-size: var(--ro-fs); }
.ro-line + .ro-line { margin-top: 2px; }
.ro-note, .ro-small { font-size: calc(var(--ro-fs) * 0.8); color: var(--ink2); }
.ro-row.ro-small { border-left-color: transparent; background: none; padding-top: 0; }
.ex-readout .katex-display { margin: 0; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Labels on the plane: a flat page-colour fill so grid lines never cross the characters. */
.plane-label { background: var(--page); padding: 0; border-radius: 2px; }
/* Maths inside sentences never breaks inside a formula (readout rows may still wrap after "="). */
.ex-controls .katex, .ro-text .katex, .ro-note .katex, .ro-small .katex { white-space: nowrap; }
.ex-controls .katex-html, .ro-text .katex-html, .ro-note .katex-html, .ro-small .katex-html { white-space: nowrap; }

/* a slider block that does not control the point right now: no knob, the value shows the point's actual value */
/* a plain grey track: no knob and no fill, since the point's value may lie between the stops */
.ex-slider.passive input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
.ex-slider.passive input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line); }
.ex-slider.passive input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
.ex-slider.passive input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; opacity: 0; }
.ex-slider.passive input[type=range]::-moz-range-thumb { width: 18px; height: 18px; opacity: 0; border: 0; }
.ex-slider.passive .ex-slider-value { color: var(--ink2); }
.ex-slider.passive.role-mod .ex-slider-value { color: var(--mod); }
.ex-slider.passive.role-arg .ex-slider-value { color: var(--arg); }

/* wide: bigger controls, and the values box fills the room the plane leaves beside it */
.ex-wide .ex-formula { font-size: 19px; padding: 8px 14px; }
.ex-wide .ex-block { padding: 8px 12px; }
.ex-wide .ex-block-title { font-size: 17px; margin-bottom: 4px; }
.ex-wide .ex-slider { font-size: 21px; min-height: 48px; }
.ex-wide .ex-slider input[type=range] { height: 48px; }
.ex-wide .ex-check { font-size: 16px; }
.ex-wide .ex-values { padding: 6px 14px; }

/* a phone: the values box takes the room under the plane; smaller titles, the same big values */
.ex:not(.ex-wide) { --ro-base: 17px; }
.ex:not(.ex-wide) .ex-values { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.ex:not(.ex-wide) .ex-block { padding: 4px 8px; }
.ex:not(.ex-wide) .ex-block-title { font-size: 14px; }
.ex:not(.ex-wide) .ex-slider { min-height: 40px; }
.ex:not(.ex-wide) .ex-slider input[type=range] { height: 40px; }
.ex:not(.ex-wide) .ex-check { font-size: 14px; min-height: 36px; }
.ex:not(.ex-wide) .ro-row { margin: 4px 0; padding: 2px 10px; }
.ex:not(.ex-wide) .plane-label { font-size: 16px; }
/* a short phone (e.g. 360 x 740): the plane keeps its size; the boxes around it tighten a little */
@media (max-height: 800px) {
  .ex:not(.ex-wide) { --ro-base: 16px; }
  .ex:not(.ex-wide) .ex-formula { font-size: 15px; padding: 4px 10px; }
  .ex:not(.ex-wide) .ex-block-title { font-size: 13px; }
  .ex:not(.ex-wide) .ex-slider { min-height: 36px; font-size: 17px; }
  .ex:not(.ex-wide) .ex-slider input[type=range] { height: 36px; }
  .ex:not(.ex-wide) .ex-check { font-size: 13px; min-height: 32px; }
  .ex:not(.ex-wide) .ro-row { margin: 3px 0; }
}
/* wide: the values box may not push the controls off a short screen (a phone on its side) */
.ex-wide .ex-values { max-height: var(--values-max, none); overflow-y: auto; }
/* a short screen (a phone with its browser bars, a phone on its side): everything cannot fit at a
   readable size, so the area under the top bar scrolls and the plane stays pinned at its top; the
   values and the sliders keep their full size (owner's review 7, 2026-10-11) */
.ex-scroll .ex-main { overflow-y: auto; overscroll-behavior: contain; }
.ex-scroll .ex-plane { position: sticky; top: 0; z-index: 3; background: var(--page);
  box-shadow: -80px 0 0 var(--page), 80px 0 0 var(--page), 0 8px 0 var(--page); }
.ex-scroll:not(.ex-wide) .ex-values { flex: none; overflow: visible; }
.ex-wide.ex-scroll .ex-plane { align-self: start; box-shadow: none; }
.ex-wide.ex-scroll .ex-values { max-height: none; overflow: visible; }
/* upright and scrolling: the two slider blocks one under the other, so each slider runs the full width */
.ex-scroll:not(.ex-wide) .ex-controls { grid-template-columns: minmax(0, 1fr); }
/* a phone on its side, too short for a readable plane: the plane keeps its readable size and the
   page scrolls (the plane is not pinned: it is taller than the screen); a card suggests turning it */
.ex-wide.ex-short .ex-plane { position: static; }
.ex-rotate { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 16px; background: var(--page); color: var(--ink); text-align: center; }
.ex-rotate[hidden] { display: none; }
.ex-rotate svg { color: var(--purple); }
.ex-rotate p { margin: 0; max-width: 420px; font-size: 17px; line-height: 1.45; }
.ex-rotate-go { min-height: 40px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--purple); background: var(--page);
  color: var(--purple); font: 600 15px "Open Sans", system-ui, sans-serif; cursor: pointer; }
