/* /play/ layout on the tokens of /style.css; token colours (.t-*) come from /docs/docs.css. */

/* .field, .row and friends set display; the hidden attribute must still win. */
body.play [hidden] { display: none !important; }
.pg-title { margin-bottom: 16px; }
.pg-lead { margin: 0 0 32px; }
.pg-bar { border-top: 1px solid var(--ink); padding-block: 16px; }
.pg-pick { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 260px; max-width: 420px; }
.pg-pick > span { flex: none; }
.pg-pick select { padding: 6px 8px; min-width: 0; }
#share-why { margin: 0 0 8px; }

.pg-work { display: grid; grid-template-columns: var(--columns); gap: var(--gutter); align-items: start; }
.pg-editor { grid-column: span 7; min-width: 0; }
.pg-out { grid-column: span 5; }
@media (max-width: 900px) { .pg-work > * { grid-column: 1 / -1; } }

/* Editor: a transparent textarea over a highlight layer with identical metrics. */
.ed { --ed-font: 13px; --ed-lh: 20px; --ed-pad: 12px;
  display: grid; grid-template-columns: auto minmax(0, 1fr); border: 1px solid var(--ink); background: var(--paper2);
  height: min(70vh, 640px); min-height: 320px; }
.ed pre, .ed textarea { font: var(--ed-font)/var(--ed-lh) ui-monospace, "SF Mono", Menlo, Consolas, monospace; tab-size: 2; margin: 0; }
.ed-gutter { padding: var(--ed-pad) 8px var(--ed-pad) 10px; text-align: right; color: var(--ink2); overflow: hidden; user-select: none;
  border-right: 1px dashed var(--ink2); min-width: 3.2em; white-space: pre; }
.ed-code { position: relative; min-width: 0; }
.ed-hl, .ed textarea { position: absolute; inset: 0; padding: var(--ed-pad); white-space: pre; overflow-wrap: normal; word-break: normal; }
.ed-hl { overflow: hidden; color: var(--ink); pointer-events: none; }
.ed textarea { width: 100%; height: 100%; resize: none; border: 0; border-radius: 0; background: transparent; color: transparent;
  caret-color: var(--ink); overflow: auto; min-height: 0; }
.ed textarea::selection { background: color-mix(in srgb, var(--stamp) 28%, transparent); color: transparent; }
.ed textarea:focus { outline: 2px solid var(--stamp); outline-offset: -2px; }
/* Diagnostics: wavy = error, dotted = warning; zero-width spans get a bar. Shape, not only colour. */
.ed-hl .d-error { text-decoration: wavy underline var(--stamp); text-decoration-skip-ink: none; text-underline-offset: 3px; }
.ed-hl .d-warning { text-decoration: dotted underline var(--ink2); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.ed-hl .mark { display: inline-block; width: 0; height: var(--ed-lh); vertical-align: top; box-shadow: -1px 0 0 1px var(--stamp); }
.ed-hl .mark.d-warning { box-shadow: -1px 0 0 1px var(--ink2); }

.pg-out { min-width: 0; }
.pg-tabs { margin-bottom: 6px; }
.pg-tabs button:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
.pg-note { margin: 0 0 10px; }
[role=tabpanel] { min-height: 120px; }
[role=tabpanel]:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
.pg-actions { margin-bottom: 8px; }
.pg-pre { max-height: min(60vh, 560px); white-space: pre; }
.pg-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0; }
.pg-dl dt { color: var(--ink2); }
.pg-dl dd { margin: 0; font-family: ui-monospace, "SF Mono", Menlo, monospace; word-break: break-word; }

.pg-diags { list-style: none; margin: 0; padding: 0; max-height: min(60vh, 560px); overflow: auto; }
.pg-diags li { border-top: 1px solid var(--line); padding: 8px 0; }
.pg-diags li:first-child { border-top: 0; }
.pg-diags button { appearance: none; border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer; width: 100%; display: grid; gap: 2px; }
.pg-diags button:hover .pg-msg { text-decoration: underline; }
.pg-diags button:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
.pg-head { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink2); }
.pg-head code { color: var(--ink); font-weight: 700; }
.sev-error .pg-sev { color: var(--stamp); font-weight: 700; }
.pg-help { margin: 4px 0 0; font-size: 13px; color: var(--ink2); }
.pg-help a { margin-left: 8px; }

.pg-prompt { width: 100%; min-height: 260px; height: min(50vh, 460px); font: 12.5px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; white-space: pre-wrap; }
.pg-ai { margin-top: 28px; }
.pg-ai h2 { margin-bottom: 4px; }
@media (max-width: 560px) { .pg-ai .grid2 { grid-template-columns: 1fr; } .ed { height: 56vh; } }
