/* 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); }
.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%; }
.formats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.format h2 { margin-bottom: 8px; }
canvas.pic.mapc { width: 100%; }
.stats { width: 100%; margin: 8px 0 4px; }
.stats td:first-child { text-align: left; color: var(--muted); }
.glyphrow { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.glyphfig { margin: 0; }
.glyphfig figcaption { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.glyphs { border-collapse: collapse; font-family: "JuliaMono", "DejaVu Sans Mono", Menlo, ui-monospace, monospace; }
.glyphs td { width: 15px; height: 15px; text-align: center; font-size: .8rem; line-height: 1; padding: 0; border: 1px solid var(--line); }
.glyphs td.plus { color: #2f9e44; font-weight: 700; } .glyphs td.minus { color: #e03131; font-weight: 700; } .glyphs td.zero { color: var(--muted); }
.glyphs.pick td { cursor: pointer; }
.glyphs td.sel { background: #e5dbff; }
.terms { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.term { padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); font-weight: 700; }
.term.plus { color: #2f9e44; } .term.minus { color: #e03131; }
.outs td.best code { font-weight: 700; text-decoration: underline; }
.routes { display: block; width: 100%; height: auto; }
.routes .route { fill: none; stroke: var(--muted); opacity: .25; }
.routes .route.sel { stroke: #e8590c; opacity: .95; }
.routes .tok { fill: var(--fg); font-size: 15px; cursor: pointer; }
.routes .tok.sel { fill: #e8590c; font-weight: 700; }
.routes .expert rect { stroke: var(--line); stroke-width: 1; }
.routes .expert.sel rect { stroke: #e8590c; stroke-width: 3; }
.routes .ename { font-size: 12px; fill: #1d1d1f; }
.routes .eload { font-size: 12px; fill: #5f3dc4; font-weight: 600; }
input.sentence { font: inherit; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); min-width: 280px; flex: 1 1 280px; }
.egrid { border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .85rem; }
.egrid td { border: 1px solid var(--line); padding: 3px 6px; text-align: right; min-width: 58px; }
.egrid td.on { background: #e5dbff; color: #1d1d1f; font-weight: 700; box-shadow: inset 0 0 0 2px #e8590c; }
.pair figure.wide { max-width: none; flex: 2 1 420px; }
canvas.pic.strip { width: 100%; aspect-ratio: 121 / 28; height: auto; }
.panel a { color: var(--accent); }
.changes { margin: 4px 0 10px; padding-left: 20px; font-variant-numeric: tabular-nums; }
.bars { display: flex; gap: 4px; align-items: flex-end; height: 120px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.bars .fill { width: 100%; background: #9775fa; border-radius: 3px 3px 0 0; min-height: 1px; }
.bars span { font-size: .7rem; color: var(--muted); }
@media (max-width: 760px) {
  .formats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout { grid-template-columns: 1fr; }
  .line { font-size: 1rem; }
  .gen { margin-left: 0; width: 100%; }
}

/* cnn-digits: the drawing pad, rows of 8 maps, the patch, digit bars */
.padbox { width: min(100%, 300px); touch-action: none; cursor: crosshair; }
canvas.pic.pad { width: 100%; border-radius: 6px; }
.maps8 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 6px 0 12px; }
.maps8.kerns { grid-template-columns: repeat(8, minmax(0, 1fr)); max-width: 420px; }
.maps8 figure { margin: 0; }
.maps8 figcaption { font-size: .7rem; color: var(--muted); text-align: center; }
.maps8.kerns figcaption { display: none; }
.patchrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.patchrow .op { font-size: 1.4rem; }
table.patch td { padding: 2px 6px; text-align: right; font-variant-numeric: tabular-nums; }
.bars.digits { height: 140px; }
.bars.digits .bar b { font-size: .9rem; }
.bars.digits .bar.best .fill { background: #f59f00; }
.controls button.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }

/* attention: words against words */
table.heat { border-collapse: collapse; font-size: .78rem; }
table.heat th { font-weight: 600; padding: 2px 6px; text-align: right; white-space: nowrap; }
table.heat th.ch { text-align: center; font-weight: 500; color: var(--muted); }
table.heat td { min-width: 2.7em; padding: 3px 4px; text-align: center; font-variant-numeric: tabular-nums; }
table.heat tr.pick { cursor: pointer; }
table.heat tr.sel th { color: var(--accent); }
table.heat tr.sel td { outline: 1px solid var(--accent); }
.outs tr.best td { font-weight: 700; }

/* backprop: small arrays side by side */
.arrs { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; margin: 6px 0 10px; }
figure.arr { margin: 0; }
figure.arr figcaption { font-size: .75rem; color: var(--muted); margin-top: 4px; }
figure.arr table.heat td { min-width: 3.4em; }

b.loss { color: #e8590c; } b.right { color: #1c7ed6; }

/* a picture a program showed ([]S_HOW), such as a Plot chart */
.picture svg { width: 100%; max-width: 420px; height: auto; border: 1px solid var(--line); border-radius: 6px; display: block; }
