:root {
  --bg: #ffffff;
  --fg: #1d1d1f;
  --muted: #5f6368;
  --surface: #f6f7f9;
  --border: #dfe2e6;
  --code-bg: #fbfbfc;
  --error: #b3261e;
  --error-bg: #fdf0ef;
  --link: var(--accent);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --fg: #e6e6e6;
    --muted: #a0a4ab;
    --surface: #1a1d22;
    --border: #2e333a;
    --code-bg: #15181c;
    --error: #ff8a80;
    --error-bg: #2a1716;
    --link: var(--accent-bright);
  }
  .figure { background: #ffffff; } /* figures are drawn on white */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--link); }
code, pre, textarea, .output { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14px; }
.bar {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.bar h1 { font-size: 18px; margin: 0; }
.home { text-decoration: none; font-weight: 600; }
#examples { display: flex; flex-wrap: wrap; gap: 4px; }
#examples a {
  padding: 2px 10px; border-radius: 999px; text-decoration: none; color: var(--fg);
  border: 1px solid var(--border); font-size: 14px;
}
#examples a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
main { max-width: 920px; margin: 0 auto; padding: 0 16px 48px; }
.tools {
  position: sticky; top: 0; z-index: 1; background: var(--bg);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
button, .open {
  font: inherit; font-size: 14px; padding: 4px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--fg); cursor: pointer;
}
#run { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button:disabled { opacity: .55; cursor: default; }
.open input { display: none; }
#status { color: var(--muted); font-size: 14px; }
.prose { overflow-wrap: anywhere; }
.prose pre { background: var(--surface); padding: 8px 12px; border-radius: 6px; overflow-x: auto; }
.prose .math { font-style: italic; }
.cell { margin: 16px 0; }
.cell textarea {
  display: block; width: 100%; resize: vertical; tab-size: 4; -moz-tab-size: 4;
  padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 6px; background: var(--code-bg); color: var(--fg); line-height: 1.45;
  white-space: pre; overflow-x: auto;
}
.cell textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.cell .meta { color: var(--muted); font-size: 12px; margin: 4px 0 0 4px; min-height: 1em; }
.output {
  margin: 6px 0 0; padding: 8px 12px; background: var(--surface); border-radius: 6px;
  white-space: pre-wrap; overflow-x: auto; overflow-wrap: anywhere;
}
.output.error { background: var(--error-bg); color: var(--error); }
.output.skipped { color: var(--muted); font-style: italic; }
.figure { margin: 8px 0 0; border-radius: 6px; overflow-x: auto; }
.figure svg { display: block; max-width: 100%; height: auto; }
.figure img { max-width: 100%; }
.stale .output, .stale .figure { opacity: .45; }
footer { max-width: 920px; margin: 0 auto; padding: 16px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--border); }
.version { font-size: 12px; }
