/* The playground (/play): the book's bar, then the editor beside the
   capabilities and the run. Colours and fonts from tokens.css. */
html, body { height: 100%; }
body { display: flex; flex-direction: column; overflow: hidden; }
.bar .ver { font: 500 12.5px/1 var(--f-mono); color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius-full); padding: 4px 8px; margin-left: -2px; }
.brand { margin-right: 0; }
.bar .spacer { flex: 1; }
.bar select, .bar .btn { font: 500 14px/1 var(--f-ui); height: 34px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); padding: 0 12px; cursor: pointer; }
.bar select { max-width: 220px; }
.bar .btn { width: auto; display: inline-flex; align-items: center; }
#editor, #editor * { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.bar .btn:hover, .bar select:hover { border-color: var(--accent); }
.bar .btn.run { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.bar .btn.run:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.bar .btn.run kbd { font: 500 11.5px/1 var(--f-mono); opacity: .7; }
.play { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 16px; padding: 16px; background: var(--side); }
.col { min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.window { background: var(--code-bg); border: 1px solid var(--code-line); border-radius: var(--radius-md); overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.window .head { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; background: var(--code-bar); border-bottom: 1px solid var(--code-line); color: var(--code-muted); font: 500 12.5px/1 var(--f-mono); }
.window .head .dots { display: flex; gap: 6px; }
.window .head .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--code-line); }
.window .head .title { color: var(--code-fg); }
/* the state of the check or the run: a dot and a word, at the bar's end */
.window .head .state { margin-left: auto; display: flex; align-items: center; gap: 7px; font: 500 12.5px/1 var(--f-ui); color: var(--code-muted); }
.window .head .state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--code-line); }
.window .head .state.bad { color: var(--err); }
.window .head .state.bad::before { background: var(--err); }
.window .head .state.good { color: var(--ok); }
.window .head .state.good::before { background: var(--ok); }
.window .head .state.busy::before { background: var(--code-k); animation: pulse 1s ease-in-out infinite; }
.window .head .state.waiting { color: var(--code-k); }
.window .head .state.waiting::before { background: var(--code-k); }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .window .head .state.busy::before { animation: none; } }
#editor { flex: 1; min-height: 0; overflow: auto; font: 13.5px/1.7 var(--f-mono); padding: 8px 0; background: var(--code-bg); }
#editor diffs-container, #editor pre { --diffs-font-family: var(--f-mono); --diffs-font-size: 13.5px; --diffs-line-height: 23px; }
.diags { max-height: 30%; overflow: auto; border-top: 1px solid var(--code-line); font: 13px/1.5 var(--f-mono); color: var(--code-fg); }
.diags:empty { display: none; }
.diag { display: block; width: 100%; text-align: left; background: none; border: 0; color: inherit; font: inherit; padding: 8px 14px; cursor: pointer; border-bottom: 1px solid var(--code-line); }
.diag:hover { background: var(--code-bar); }
.diag .sev { color: var(--err); font-weight: 600; }
.diag .sev.warning { color: var(--warn); }
.diag .loc { color: var(--loc); }
.diag .fix { color: var(--ok); display: block; margin-top: 2px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px 16px; font: 14px/1.5 var(--f-ui); color: var(--ink-2); }
.panel h2 { font: 600 13px/1 var(--f-ui); color: var(--ink-3); margin: 0 0 10px; letter-spacing: 0; }
.caps { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 500 12.5px/1 var(--f-mono); padding: 5px 8px; border-radius: var(--radius-sm); background: var(--surface-sunken); color: var(--ink-2); border: 1px solid var(--line); }
.chip.cap { background: var(--cap-soft); color: var(--cap); border-color: transparent; }
.chip.pure { color: var(--ink-3); }
.fn { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; }
.fn code { font-size: 12.5px; }
.note { margin: 10px 0 0; font-size: 13.5px; color: var(--ink-3); }
.run-window { flex: 1; }
#out { flex: 1; min-height: 0; margin: 0; border: 0; border-radius: 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px 18px; background: var(--code-bg); font: 13.5px/1.7 var(--f-mono); }
#out:empty::before { content: "Press Run to run main. What it prints shows here, and what you type below goes to its stdin."; color: var(--term-muted); font-family: var(--f-ui); }
#out .cmd { color: var(--term-muted); }
#out .cmd b { color: var(--code-fg); font-weight: 500; }
#out .err { color: var(--err); font-weight: 400; }
#out .sys { color: var(--warn); }
#out .typed { color: var(--code-k); }
.stdin { display: flex; gap: 8px; padding: 8px; border-top: 1px solid var(--code-line); background: var(--code-bar); }
.stdin input { flex: 1; min-width: 0; background: var(--code-bg); color: var(--code-fg); border: 1px solid var(--code-line); border-radius: 6px; font: 13px var(--f-mono); padding: 7px 10px; }
.stdin input:focus { outline: 1px solid var(--code-k); }
.stdin button { font: 500 12.5px var(--f-ui); background: none; border: 1px solid var(--code-line); color: var(--code-muted); border-radius: 6px; padding: 0 10px; cursor: pointer; }
.stdin button:hover { color: var(--code-fg); }
.stdin.waiting input { border-color: var(--code-k); }
@media (max-width: 900px) {
  body { overflow: auto; height: auto; }
  .play { grid-template-columns: 1fr; }
  #editor { min-height: 360px; }
  .run-window { min-height: 280px; }
  .bar .ver, .bar select { display: none; }
}
