/* Playground layout: steps on the left, the live sketcher and its messages on the right, the API console below. */
.pg { max-width: 1320px; margin: 0 auto; padding: 28px 20px 64px; }
.pg-intro { max-width: 760px; margin-bottom: 20px; }
.pg-intro h1 { margin-bottom: .25em; }
.pg-grid { display: grid; grid-template-columns: minmax(340px, 470px) minmax(0, 1fr); gap: 24px; align-items: start; }

.steps { display: grid; gap: 14px; }
.step { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 18px 20px 16px; }
.step-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.step h2 { font-size: 1.05rem; margin: 0; padding: 0; border: 0; display: flex; align-items: center; gap: 10px; }
.step .n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--panel); font-size: .85rem; flex: none; }
.step .opt { font-weight: 400; color: var(--pencil); font-size: .85rem; }
.step.done .n { background: var(--ok); }
.keyrow { display: flex; gap: 8px; align-items: center; }
.keyrow input { flex: 1; font-family: var(--mono); }
.keyrow .btn { margin-top: 4px; }
label.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; margin: -2px 0 12px; }
.result { margin-top: 12px; font-size: .9rem; }
.result pre { max-height: 280px; margin: 8px 0 0; }
.result .msg { margin: 0; }
.result .msg.bad { color: var(--flag); font-weight: 600; }
.result .msg.ok { color: var(--ok); font-weight: 600; }
.origins { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.origins li { margin: 0; font-family: var(--mono); font-size: .8rem; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--rule); background: var(--code-bg); }
.origins li.here { border-color: var(--teal); color: var(--teal); }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
.summary div { border: 1px solid var(--rule); border-radius: var(--r-md); padding: 10px 12px; background: var(--code-bg); min-width: 0; }
.summary dt { font-size: .8rem; color: var(--pencil); }
.summary dd { margin: 2px 0 0; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Stage */
.stage { position: sticky; top: 72px; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 14px; display: grid; gap: 10px; max-height: calc(100vh - 88px); grid-template-rows: auto minmax(360px, 1fr) auto auto minmax(120px, 30%); }
.stage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.stage-head h2 { font-size: 1.05rem; margin: 0; padding: 0; border: 0; }
.frame { position: relative; border: 1px solid var(--rule-strong); border-radius: var(--r-md); overflow: hidden; background: var(--code-bg); min-height: 360px; }
.frame iframe { position: absolute; inset: 0; width: 100% !important; height: 100% !important; border: 0 !important; border-radius: 0 !important; }
.frame-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--pencil); text-align: center; padding: 20px; }
.frame-empty svg { width: 120px; color: var(--rule-strong); }
.frame-empty p { margin: 0; }
.frame-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.frame-actions select { width: auto; margin: 0; padding: 5px 8px; font-size: .85rem; min-height: 32px; }
.log-head { display: flex; align-items: center; justify-content: space-between; }
.log-head h3 { margin: 0; font-size: .95rem; }
.log { list-style: none; margin: 0; padding: 0; overflow: auto; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--code-bg); font-size: .82rem; min-height: 0; }
.log li { margin: 0; padding: 7px 10px; border-bottom: 1px solid var(--rule); }
.log li:last-child { border-bottom: 0; }
.log-empty { color: var(--pencil); }
.log details summary { cursor: pointer; display: grid; grid-template-columns: 64px 18px minmax(0, auto) 1fr; gap: 8px; align-items: baseline; list-style: none; }
.log details summary::-webkit-details-marker { display: none; }
.log .t { color: var(--pencil); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.log .dir { font-weight: 700; text-align: center; }
.log .dir.in { color: var(--ok); }
.log .dir.out { color: var(--tok-num); }
.log .type { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.log .gist { color: var(--pencil); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .entry-bad .type { color: var(--flag); }
.log pre { margin: 8px 0 2px; max-height: 260px; font-size: .78rem; }
.log li.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--teal-soft); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .log li.flash { animation: none; } }

/* Console */
.console { margin-top: 28px; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 20px; }
.console h2 { margin-top: 0; padding-top: 0; border: 0; font-size: 1.25rem; }
.console-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.console-grid > div, .row > * { min-width: 0; }
select { max-width: 100%; }
.resp-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.resp-head h3 { margin: 0 0 8px; font-size: .95rem; }
.resp { max-height: 360px; min-height: 120px; }

@media (max-width: 1060px) {
  .pg-grid { grid-template-columns: 1fr; }
  .stage { position: static; max-height: none; grid-template-rows: auto 560px auto auto 260px; }
  .console-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .pg { padding: 20px 16px 48px; }
  .stage { grid-template-rows: auto 480px auto auto 240px; }
  .log details summary { grid-template-columns: 56px 16px 1fr; }
  .log .gist { display: none; }
}

.api-start{margin-bottom:24px;max-width:900px}.api-start h2{margin-bottom:12px}.key-help{margin-top:20px;border-top:1px solid var(--rule);padding-top:12px}.key-help summary{cursor:pointer;font-weight:600;min-height:44px;padding-block:10px}.key-help li{margin-block:10px}.key-help a:not(.btn){text-decoration:underline;text-underline-offset:3px}.key-help .btn{margin:4px 6px 4px 0}
