:root { --fg: #1d2330; --muted: #5b6475; --border: #d9dde5; --accent: #2a6fdb; --bg: #fff; --code: #f5f7fa; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, sans-serif; color: var(--fg); background: var(--bg); }
header, main, footer { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
header { padding-top: 24px; }
header a { color: var(--accent); text-decoration: none; }
h1 { margin: 4px 0 4px; font-size: 26px; }
p.lead { margin: 0 0 16px; color: var(--muted); }
.plots { height: 480px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; touch-action: none; }
.plots.tall { height: 640px; }
.plots.short { height: 240px; }
.plots.projection { height: 330px; }
.plots + .plots { margin-top: 12px; }
.row { display: flex; gap: 12px; }
.row > .plots { flex: 1; min-width: 0; }
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 12px 0; color: var(--muted); }
button, select { font: inherit; padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; background: #fff; }
#status { font-size: 13px; color: var(--muted); min-height: 1.5em; }
section.editor { max-width: 1100px; margin: 24px auto 32px; padding: 0 20px; }
.editor-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.editor-bar h3 { margin: 0 auto 0 0; font-size: 17px; }
.editor-bar button[data-action=run] { background: var(--accent); border-color: var(--accent); color: #fff; }
.editor-host { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; font-size: 13px; }
.editor-host .CodeMirror { height: auto; background: var(--code); font-size: 13px; }
.editor-host textarea { display: block; width: 100%; border: 0; padding: 12px; background: var(--code); color: inherit;
  font: 13px/1.45 ui-monospace, monospace; resize: vertical; }
.run-error { margin: 8px 0 0; padding: 10px 12px; border-radius: 6px; background: #fdecea; color: #8a1c13; white-space: pre-wrap; font-size: 13px; }
.run-notice { margin: 0 0 8px; padding: 8px 12px; border-radius: 6px; background: #fff6dc; color: #6b4e00; font-size: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 16px 0 32px; }
.card { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: 6px; color: inherit; text-decoration: none; }
.card:hover { border-color: var(--accent); }
.card h2 { margin: 0 0 4px; font-size: 16px; color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
footer { color: var(--muted); font-size: 13px; padding-bottom: 24px; }
code { background: var(--code); padding: 1px 4px; border-radius: 3px; }
.hint { font-size: 13px; color: var(--muted); }
table.events { border-collapse: collapse; width: 100%; font-size: 14px; margin: 12px 0; }
table.events td, table.events th { padding: 4px 8px; border-bottom: 1px solid var(--border); text-align: left; }
table.events tr { cursor: pointer; }
table.events tr:hover, table.events tr.selected { background: #eef3fc; }
.card img { display: block; width: 100%; aspect-ratio: 16 / 7; object-fit: cover; border-radius: 4px; margin-bottom: 8px; background: var(--code); }

/* Phones: shorter plots, panels stacked, nothing wider than the screen. */
@media (max-width: 700px) {
  header, main, footer { padding: 0 12px; }
  header { padding-top: 14px; }
  h1 { font-size: 21px; }
  p.lead { font-size: 14px; }
  .plots { height: 62vh; }
  .plots.tall { height: 80vh; }
  .plots.short { height: 32vh; }
  .plots.projection { height: 42vw; }   /* three square panes side by side */
  .row { flex-direction: column; }
  .row > .plots { flex: none; }   /* stacked, each keeps its own height */
  section.editor { padding: 0 12px; }
  .editor-host, .editor-host .CodeMirror { font-size: 12px; }
  .cards { grid-template-columns: 1fr; }
}
