/* playground.css - the fourth-wall layer over the Stage IX research site.
   Uses theme.css tokens only, so light and dark mode follow the site. */

#pg-voice {
  position: fixed; left: 16px; bottom: calc(16px + var(--pg-lift, 0px)); z-index: 2147483000;
  max-width: min(360px, calc(100vw - 32px));
  font: 400 12px/1.6 var(--mono); color: var(--text-primary);
  background: color-mix(in srgb, var(--surface-1) 92%, transparent);
  border: 1px solid var(--border-col); border-left: 2px solid var(--brand-l);
  padding: 10px 14px 10px 12px; backdrop-filter: blur(6px);
  opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s;
  pointer-events: none;
}
#pg-voice.on { opacity: 1; transform: none; }
#pg-voice .who { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--brand-l); margin-bottom: 2px; }
#pg-voice .caret { display: inline-block; width: 7px; height: 12px; background: var(--brand-l); vertical-align: -1px; margin-left: 2px; animation: pg-blink 1s steps(1) infinite; }
@keyframes pg-blink { 50% { opacity: 0; } }

#pg-dock {
  position: fixed; right: 16px; bottom: calc(16px + var(--pg-dock-lift, 0px)); z-index: 2147483001; display: flex; gap: 6px;
  flex-wrap: wrap; justify-content: flex-end; max-width: calc(100vw - 32px);
}
#pg-dock .pg-lv { display: flex; gap: 2px; }
#pg-dock .pg-lv button { padding: 9px 9px; min-width: 30px; }
#pg-dock button { transition: background .25s, border-color .25s, color .25s, translate .15s; }
#pg-dock button:active { translate: 0 1px; }
#pg-dock button {
  font: 500 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--border-col);
  padding: 9px 12px; cursor: pointer;
}
#pg-dock button[aria-pressed="true"] { background: var(--surface-active); border-color: var(--brand); color: var(--brand-l); }

/* the visitor's own trace: where the cursor has been */
#pg-trace { position: fixed; inset: 0; z-index: 8000; pointer-events: none; }

/* play mode: blocks become props */
html.pg-play .pg-prop { cursor: grab; position: relative; z-index: 10; transition: box-shadow .2s; }
html.pg-play .pg-prop:hover { box-shadow: 0 0 0 1px var(--brand); }
.pg-prop.pg-held { position: relative; cursor: grabbing; z-index: 50; box-shadow: 0 12px 40px rgba(0,0,0,.45), 0 0 0 1px var(--brand-l); }
.pg-prop.pg-pinned::after {
  content: "pinned"; position: absolute; top: 6px; right: 8px;
  font: 400 9px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--brand-l);
}
html.pg-play .pg-prop a { pointer-events: none; }
html.pg-play body { touch-action: pan-y; }
html.pg-play .pg-prop, html.pg-play .pg-prop * { touch-action: none; }
.pg-wobble { animation: pg-wobble .5s; }
@keyframes pg-wobble { 25% { rotate: -1.2deg; } 75% { rotate: 1.2deg; } }

/* backstage: the scaffolding shows */
html.pg-back body * { outline: 1px dashed color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: -1px; }
html.pg-back section { position: relative; }
html.pg-back .pg-tag {
  position: absolute; top: 0; left: 0; z-index: 60; pointer-events: none;
  font: 400 9px/1.4 var(--mono); color: var(--black); background: var(--brand-l); padding: 1px 5px;
}
html.pg-back img, html.pg-back svg { filter: grayscale(1) contrast(.8); }
html.pg-back body { background-image:
  linear-gradient(var(--grey-2) 1px, transparent 1px),
  linear-gradient(90deg, var(--grey-2) 1px, transparent 1px);
  background-size: 24px 24px; }

#pg-back {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 2147482999; width: min(380px, 100vw);
  background: var(--surface-1); border-left: 1px solid var(--border-col);
  font: 400 11px/1.6 var(--mono); color: var(--text-primary);
  padding: 20px 18px 80px; overflow-y: auto; transform: translateX(100%); transition: transform .35s;
}
html.pg-back #pg-back { transform: none; }
#pg-back h3 { font: 500 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--brand-l); margin: 18px 0 6px; }
#pg-back h3:first-child { margin-top: 0; }
#pg-back dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; }
#pg-back dt { color: var(--text-dim); }
#pg-back dd { margin: 0; text-align: right; }
#pg-back .sw { display: flex; flex-wrap: wrap; gap: 4px; }
#pg-back .sw span { width: 26px; height: 26px; border: 1px solid var(--border-col); }
#pg-back ol { margin: 0; padding-left: 18px; color: var(--text-dim); max-height: 220px; overflow: hidden; }
#pg-back ol li:first-child { color: var(--text-primary); }
#pg-back p { color: var(--text-dim); margin: 0; }

@media (max-width: 640px) {
  #pg-voice { bottom: calc(var(--pg-dock-h, 40px) + 28px + var(--pg-dock-lift, 0px)); }
  #pg-back { width: 100vw; }
}
@media (prefers-reduced-motion: reduce) {
  #pg-voice, #pg-back { transition: none; }
  .pg-wobble { animation: none; }
}

/* a moved block gets its own ground, so it never prints over the text it now covers */
.pg-prop[style*="translate"], .pg-prop.pg-pinned { position: relative; z-index: 10; background: var(--surface-bg); }
html.pg-back #pg-back, html.pg-back #pg-back *, html.pg-back #pg-voice, html.pg-back #pg-voice *, html.pg-back #pg-dock * { outline: none; }

/* the break button reads as the dangerous one */
html.pg-broken #pg-dock [data-m="lens"], html.pg-broken #pg-dock [data-m="sound"] { display: none; } /* the break bar carries them */

/* no menu (Sep, msg 1078): dock and break bar read as an experiment's caption, not a toolbar.
   Mono uppercase words on a quiet plate, separated by slashes; no button boxes */
#pg-dock { align-items: baseline; gap: 0; padding: 7px 10px; background: color-mix(in srgb, var(--surface-1) 88%, transparent);
  font: 400 10px/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); backdrop-filter: blur(6px); }
#pg-dock .pg-cap { margin-right: 4px; }
#pg-dock button.pg-word { white-space: nowrap; }
#pg-dock button.pg-word, #pg-breakbar button { background: none !important; border: 0 !important; padding: 6px 2px !important; min-height: 0 !important;
  color: var(--text-primary) !important; font: 500 10px/1 var(--mono) !important; letter-spacing: .12em; text-transform: uppercase; cursor: pointer; clip-path: none !important; }
#pg-dock button.pg-word::before, #pg-breakbar button::before { content: "/ "; color: var(--text-dim); font-weight: 400; }
#pg-dock button.pg-word:hover, #pg-breakbar button:hover { color: var(--brand-l) !important; }
#pg-dock button[aria-pressed="false"], #pg-breakbar button[aria-pressed="false"] { color: var(--text-dim) !important; }
@media (max-width: 640px) { #pg-dock .pg-cap { flex-basis: 100%; text-align: right; } }
