/* The shared look of the X_eTaL demo pages (shared/microscope). */
:root {
  --bg: #fbfaf7; --fg: #1d1d1f; --muted: #5f6368; --card: #ffffff; --line: #e3e0d8;
  --accent: #2457c5; --on: #1d1d1f; --off: #f0eee8; --sel: #e8590c;
  --s3: #2f9e44; --s4: #1971c2;
  --t-builtin: #1c5fd4; --t-user: #2b8a3e; --t-arg: #a61e8f; --t-num: #9c6500; --t-sym: #0b7285;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #141518; --fg: #e8e6e3; --muted: #a0a4ab; --card: #1d1f23; --line: #30333a;
  --accent: #8fb0ff; --on: #f1efe9; --off: #26292f; --sel: #ff8a4c;
  --s3: #69db7c; --s4: #74c0fc;
  --t-builtin: #8fb0ff; --t-user: #8ce99a; --t-arg: #f783ac; --t-num: #ffd43b; --t-sym: #66d9e8;
} }
:root[data-theme="dark"] {
  --bg: #141518; --fg: #e8e6e3; --muted: #a0a4ab; --card: #1d1f23; --line: #30333a;
  --accent: #8fb0ff; --on: #f1efe9; --off: #26292f; --sel: #ff8a4c;
  --s3: #69db7c; --s4: #74c0fc;
  --t-builtin: #8fb0ff; --t-user: #8ce99a; --t-arg: #f783ac; --t-num: #ffd43b; --t-sym: #66d9e8;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
header, main, footer { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
header { padding-top: 20px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 { margin: 0; font-size: 1.7rem; }
.logo { height: 44px; width: auto; border-radius: 6px; display: block; }
.lede { color: var(--muted); margin: 8px 0 12px; }
code, .line { font-family: "JuliaMono", "DejaVu Sans Mono", Menlo, ui-monospace, monospace; }
.line { display: block; font-size: 1.25rem; padding: 12px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; white-space: pre; }
.line { line-height: 2.1; }
.hl { background: #e5dbff; box-shadow: 0 0 0 2px #9775fa; border-radius: 4px; padding: .15em .1em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; color: #1d1d1f; }
.hl .t-builtin { color: #1c5fd4; } .hl .t-user { color: #2b8a3e; } .hl .t-arg { color: #a61e8f; }
.hl .t-num { color: #8a5a00; } .hl .t-sym { color: #0b7285; } .hl .t-plain { color: #1d1d1f; }
code.xtl { font-size: 1.05em; }
h2 code.xtl { font-weight: 400; }
.t-builtin { color: var(--t-builtin); } .t-user { color: var(--t-user); } .t-arg { color: var(--t-arg); }
.t-num { color: var(--t-num); } .t-sym { color: var(--t-sym); }
.timeline { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; align-items: stretch; }
.stage { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer;
  font: inherit; text-align: left; }
.stage.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.stage .sname { font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stage .shape { font-size: .8rem; color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.controls button, .controls select { font: inherit; padding: 5px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer; }
.controls button:hover { border-color: var(--accent); }
.toggle { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.gen { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.layout { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.panel.focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.panel h2 { font-size: 1rem; margin: 0 0 4px; }
.note { color: var(--muted); margin: 0 0 10px; font-size: .9rem; }
.grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); aspect-ratio: 1; }
.grid.big { width: 100%; }
.grid.mid { width: min(100%, 240px); }
.grid.mini { width: 100%; }
.cell { background: var(--off); display: flex; align-items: center; justify-content: center;
  font-size: .62rem; font-variant-numeric: tabular-nums; min-width: 0; overflow: hidden; }
.grid.big .cell { cursor: pointer; }
.cell.on { background: var(--on); }
.cell.heat { background: hsl(214 75% calc(96% - var(--heat) * 7%)); color: #1d1d1f; }
.cell.heat.hot { color: #ffffff; }
.cell.heat.s3 { outline: 2px solid var(--s3); outline-offset: -2px; }
.cell.heat.s4 { outline: 2px solid var(--s4); outline-offset: -2px; }
.cell.sel { box-shadow: inset 0 0 0 2px var(--sel); }
.nine { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 520px; }
.nine figure { margin: 0; }
.nine figcaption { text-align: center; font-size: .8rem; color: var(--muted); font-family: ui-monospace, monospace; }
.pair { display: flex; gap: 16px; flex-wrap: wrap; }
.pair .grid { width: min(100%, 220px); }
.nbhd { border-collapse: collapse; margin: 4px 0 10px; }
.nbhd td { width: 34px; height: 34px; text-align: center; border: 1px solid var(--line); font-weight: 600; }
.nbhd td.on { background: var(--on); color: var(--bg); }
.nbhd td.off { background: var(--off); }
.nbhd tr:nth-child(2) td:nth-child(2) { box-shadow: inset 0 0 0 2px var(--sel); }
.calc code { background: var(--off); padding: 2px 6px; border-radius: 4px; }
.notice { margin: -4px 0 12px; padding: 8px 12px; border-radius: 8px; background: #fff3bf; color: #5c3c00; }
.error { color: #c92a2a; white-space: pre-wrap; }
footer { color: var(--muted); font-size: .85rem; padding-top: 18px; padding-bottom: 28px;
  margin-top: 20px; border-top: 1px solid var(--line); }
footer a { color: var(--accent); }
footer .sep { margin: 0 8px; }
.shape code.xtl { font-size: .8rem; }
.t-comment { color: var(--muted); font-style: italic; }
.source { margin: 0; padding: 10px 12px; background: var(--off); border-radius: 8px; overflow: auto;
  white-space: pre-wrap; font-family: "JuliaMono", "DejaVu Sans Mono", Menlo, ui-monospace, monospace;
  font-size: .9rem; line-height: 1.7; }
canvas.pic { display: block; image-rendering: pixelated; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 4px; }
canvas.pic.clickable { cursor: crosshair; }
canvas.pic.mid { width: min(100%, 260px); }
.pair figure { margin: 0; flex: 1 1 180px; max-width: 260px; }
.pair figcaption { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.slider { display: flex; gap: 8px; align-items: center; }
.slider input { width: 180px; }
.orbitbox { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.orbit { width: 240px; height: 240px; background: var(--off); border-radius: 8px; }
.orbit .axis { stroke: var(--line); stroke-width: 1; }
.orbit .disk { fill: none; stroke: #9775fa; stroke-width: 1.5; stroke-dasharray: 4 3; }
.orbit .path { fill: none; stroke: var(--accent); stroke-width: 1.2; opacity: .7; }
.orbit .dot { fill: var(--accent); }
.orbit .dot.out { fill: #e8590c; }
.zs { border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .85rem; }
.zs th, .zs td { padding: 2px 8px; text-align: right; border-bottom: 1px solid var(--line); }
.zs tr.out td { color: #e8590c; font-weight: 600; }
.layout.even { grid-template-columns: minmax(300px, 1fr) minmax(300px, 1fr); }
.crosses { display: flex; gap: 18px; flex-wrap: wrap; }
.nbhd.num td { width: auto; min-width: 56px; padding: 0 4px; font-weight: 500; font-variant-numeric: tabular-nums; font-size: .85rem; }
.nbhd.num td:empty { border: none; }
.calc { margin: 4px 0; line-height: 1.9; }
.sky { display: block; width: 100%; aspect-ratio: 1; background: #0f1020; border-radius: 8px; }
.sky .trail { fill: none; stroke-width: 1.2; opacity: .55; }
.sky .body circle { stroke: #ffffff; stroke-width: .8; }
.sky .body circle.sel { stroke: #ff8a4c; stroke-width: 3; }
.sky .body .hit { fill: transparent; stroke: none; cursor: pointer; }
.sky .arrow { stroke-width: 1.4; }
.sky .arrow.part { stroke: #b197fc; opacity: .8; }
.sky .arrow.sum { stroke: #ff922b; stroke-width: 2.6; }
.sky .head.part { fill: #b197fc; } .sky .head.sum { fill: #ff922b; }
.forces { margin: 4px 0 10px; }
.forces td:first-child, .forces th:first-child { text-align: left; }
.forces tr.pick { cursor: pointer; }
.forces tr.pick:hover td { background: var(--off); }
.forces tr.total td { font-weight: 600; border-top: 2px solid var(--line); }
.forces td.more { color: var(--muted); text-align: left; font-style: italic; }
.forces .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.kernels { display: flex; gap: 18px; flex-wrap: wrap; }
.kname { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.kname select { font: inherit; font-size: .85rem; padding: 2px 6px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg); }
.kgrid { display: grid; grid-template-columns: repeat(3, 84px); gap: 4px; }
.kgrid input { width: 84px; font: inherit; font-size: .85rem; font-variant-numeric: tabular-nums; padding: 3px 4px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--t-num); text-align: right; }
.kgrid input:disabled { background: var(--off); }
.kgrid.k5 { grid-template-columns: repeat(5, 64px); }
.slider input[type=number] { width: 84px; font: inherit; font-size: .85rem; font-variant-numeric: tabular-nums; padding: 3px 4px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--t-num); text-align: right; }
.kgrid.k5 input { width: 64px; }
.controls button.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.product .crosses { align-items: center; gap: 10px; }
.product .op { font-size: 1.3rem; color: var(--muted); }
.product .val code { font-size: 1.1rem; }
canvas.pic.tiny { width: 100%; }
.panel a { color: var(--accent); }
.brand h1 a.wiki { color: inherit; text-decoration: none; }
.brand h1 a.wiki:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.brand h1 a.wiki .pages { color: var(--accent); vertical-align: 0.05em; }
.brand h1 button.story { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 4px; }
.dialog-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: center;
  justify-content: center; z-index: 50; padding: 16px; }
.dialog { position: relative; background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 12px;
  max-width: 560px; width: 100%; max-height: 80vh; overflow: auto; padding: 20px 24px; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.dialog h2 { margin: 0 32px 10px 0; font-size: 1.2rem; }
.dialog p { margin: 0 0 10px; }
.dialog-x { position: absolute; top: 10px; right: 12px; font-size: 1.4rem; line-height: 1; background: none; border: 0;
  color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.dialog-x:hover { color: var(--fg); background: var(--off); }
.epicycles { display: block; width: 100%; aspect-ratio: 1; background: #0f1020; border-radius: 8px; cursor: crosshair; touch-action: none; }
.epicycles .original { fill: none; stroke: #6c6f7a; stroke-width: 1.2; }
.epicycles .rebuilt { fill: none; stroke: #ff922b; stroke-width: 1; opacity: .35; }
.epicycles .traced { fill: none; stroke: #ff922b; stroke-width: 2.4; }
.epicycles .ring { fill: none; stroke: #9775fa; stroke-width: .8; opacity: .55; }
.epicycles .arm { stroke: #d0bfff; stroke-width: 1; }
.epicycles .tip { fill: #ff922b; }
.epicycles .drawn { fill: none; stroke: #74c0fc; stroke-width: 2; }
.spectrum, .errcurve { display: block; width: 100%; height: 90px; background: var(--off); border-radius: 6px; }
.spectrum .bar { fill: var(--muted); opacity: .45; } .spectrum .bar.on { fill: #9775fa; opacity: 1; }
.errcurve polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.errcurve circle { fill: #ff922b; }
.listing .fold { display: block; }
.listing .foldn { color: var(--accent); cursor: pointer; font-style: italic; font-family: system-ui, sans-serif; font-size: .85em; }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .line { font-size: 1rem; }
  .gen { margin-left: 0; width: 100%; }
}
