/* The shared look of the X_eTaL game 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; }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .line { font-size: 1rem; }
  .gen { margin-left: 0; width: 100%; }
}
/* A game page: the terminal, the notebook (shared/microscope/src/page.rs). */
.term { margin: 0; padding: 12px 14px; background: #10141a; color: #c9f7c9; border-radius: 8px;
  font: .95rem/1.5 ui-monospace, "JuliaMono", Menlo, monospace; min-height: 16em; max-height: 34em;
  overflow: auto; white-space: pre; }
.term .in { color: #ffd479; }
.term form { display: flex; gap: 6px; margin: 4px 0 0; }
.term input { flex: 1; font: inherit; background: transparent; color: #ffd479; border: 0;
  border-bottom: 1px solid #3a4a3a; outline: none; }
.term .done { color: #8fb0ff; white-space: normal; }
.term .err, .nb .err { color: #ff8787; white-space: pre-wrap; }
.term .pic, .nb .pic { white-space: normal; margin: 6px 0; }
.nb .cell { margin: 0 0 10px; }
.nb .out { margin: 4px 0 0; padding: 6px 10px; background: #10141a; color: #c9f7c9; border-radius: 6px;
  font: .9rem/1.45 ui-monospace, "JuliaMono", Menlo, monospace; white-space: pre; overflow-x: auto; }
/* An empty printed line keeps its height, as in a terminal. */
.term > div:empty, .nb .out > div:empty { min-height: 1.5em; }
/* Pictures X_eTaL draws ([]S_HOW) are scaled up to read; their content is X_eTaL's. */
.term .pic svg, .nb .pic svg { width: min(100%, 384px); height: auto; display: block; }
/* A game's title: a link to its Wikipedia article, or a button opening
   a dialog on its history and play (shared/microscope/src/page.rs). */
.brand h1 a.wiki { color: inherit; text-decoration: none; }
.brand h1 a.wiki:hover { text-decoration: underline; }
.brand h1 .glyph { vertical-align: 0.1em; color: var(--muted); }
.brand h1 button.about-open { font: inherit; color: inherit; background: none; border: 0; padding: 0;
  cursor: pointer; text-decoration: underline dotted; text-underline-offset: 0.2em; }
dialog.about { border: 1px solid var(--line); border-radius: 12px; padding: 0; max-width: min(36rem, 92vw);
  background: var(--card); color: var(--fg); }
dialog.about::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog.about .about-box { position: relative; padding: 18px 22px 14px; }
dialog.about h2 { margin: 0 0 8px; font-size: 1.15rem; }
dialog.about p { margin: 0 0 6px; line-height: 1.55; }
dialog.about .close { position: absolute; top: 6px; right: 8px; font: 1.4rem/1 system-ui, sans-serif;
  background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 8px; }
dialog.about .close:hover { color: var(--fg); }

/* An interactive game (Game::interactive): Play opens a large dialog
   with the program's latest picture, drawn at full width in its own
   proportions so a click maps straight to the picture's coordinates;
   closed by Escape, its X, or a click on the background. */
button.board-open { font: inherit; font-size: 1.05rem; padding: 8px 22px; cursor: pointer; }
dialog.board { border: 1px solid var(--line); border-radius: 12px; padding: 34px 12px 12px; width: 96vw; max-width: 96vw;
  max-height: 94vh; background: var(--card); color: var(--fg); overflow: auto; }
dialog.board::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog.board .board-pic svg { display: block; width: 100%; height: auto; cursor: pointer; }
dialog.board .close { position: absolute; top: 4px; right: 10px; font: 1.6rem/1 system-ui, sans-serif;
  background: none; border: 0; color: var(--muted); cursor: pointer; }
dialog.board .close:hover { color: var(--fg); }
pre.data { white-space: pre-wrap; font-size: .85rem; }
dialog.board .board-err { margin: 0 0 8px; padding: 8px 12px; border-radius: 8px; background: #fde2e1; color: #8a1c1c; font-weight: 600; }
h2 a.xref { font-size: .8rem; font-weight: 600; margin-left: 6px; color: var(--accent); }
