/* Playground chrome. Deliberately independent of the --cui-* tokens so the UI around the components never rescales. */
:root { --pg-bg:#f5f4f2; --pg-panel:#fff; --pg-line:#e4e1dc; --pg-text:#22211f; --pg-muted:#77736d; --pg-accent:#232222; --pg-hl:#ffd582; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; color: var(--pg-text); background: var(--pg-bg); }
button, select, input { font: inherit; color: inherit; }
.pg { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: 52px 1fr; height: 100vh; }
.pg-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--pg-panel); border-bottom: 1px solid var(--pg-line); }
.pg-brand { font-weight: 700; letter-spacing: .01em; margin-right: auto; }
.pg-brand small { font-weight: 400; color: var(--pg-muted); margin-left: 6px; }
.pg-seg { display: inline-flex; border: 1px solid var(--pg-line); border-radius: 8px; overflow: hidden; }
.pg-seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; }
.pg-seg button[aria-pressed="true"] { background: var(--pg-accent); color: #fff; }
.pg-toggle { display: inline-flex; gap: 6px; align-items: center; color: var(--pg-muted); cursor: pointer; }
.pg-side { overflow: auto; padding: 12px 8px 24px; background: var(--pg-panel); border-right: 1px solid var(--pg-line); }
.pg-side h4 { margin: 14px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--pg-muted); }
.pg-side a { display: block; padding: 6px 10px; border-radius: 6px; color: inherit; text-decoration: none; }
.pg-side a:hover { background: var(--pg-bg); }
.pg-side a[aria-current="page"] { background: var(--pg-accent); color: #fff; }
.pg-main { overflow: auto; min-width: 0; }
.pg-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px 0; }
.pg-head h2 { margin: 0; font-size: 20px; }
.pg-tabs { margin-left: auto; }
.pg-work { display: grid; grid-template-columns: 1fr 300px; gap: 16px; padding: 16px 20px 28px; align-items: start; }
.pg-work.one { grid-template-columns: 1fr; }
.pg-card { background: var(--pg-panel); border: 1px solid var(--pg-line); border-radius: 10px; }
.pg-canvas { overflow: auto; padding: 24px; border-radius: 10px; min-height: 260px; display: flex; justify-content: center; background:
  repeating-conic-gradient(#0000000a 0 25%, transparent 0 50%) 0 0 / 16px 16px, var(--cui-color-surface-bg-canvas); }
.pg-stage { width: var(--pg-w, 390px); max-width: 100%; display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: var(--cui-color-surface-bg-canvas); padding: 20px; }
.pg-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--pg-line); color: var(--pg-muted); }
.pg-bar select { padding: 4px 6px; border: 1px solid var(--pg-line); border-radius: 6px; background: #fff; }
.pg-controls { padding: 4px 14px 10px; }
.pg-controls h3, .pg-snippet h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--pg-muted); margin: 12px 0 6px; }
.pg-field { display: grid; grid-template-columns: 110px 1fr; gap: 8px; align-items: center; padding: 5px 0; }
.pg-field label { color: var(--pg-muted); overflow: hidden; text-overflow: ellipsis; }
.pg-field input[type=text], .pg-field input[type=number], .pg-field select { width: 100%; padding: 5px 7px; border: 1px solid var(--pg-line); border-radius: 6px; background: #fff; }
.pg-reset { margin: 8px 0 4px; padding: 5px 10px; border: 1px solid var(--pg-line); border-radius: 6px; background: #fff; cursor: pointer; }
.pg-snippet { grid-column: 1 / -1; padding: 4px 14px 14px; }
.pg-snippet pre { margin: 0; padding: 12px; background: #1c1b1a; color: #f1ece4; border-radius: 8px; overflow: auto; font: 12px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; }
.pg-copy { float: right; margin-top: -26px; padding: 3px 10px; border: 1px solid var(--pg-line); border-radius: 6px; background: #fff; cursor: pointer; }
.pg-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; padding: 16px 20px 28px; }
.pg-tile { overflow: hidden; }
.pg-tile > .cap { padding: 8px 12px; border-bottom: 1px solid var(--pg-line); font-weight: 600; }
.pg-tile > .cap span { color: var(--pg-muted); font-weight: 400; margin-left: 6px; }

.pg-empty { padding: 40px; color: var(--pg-muted); }

.pg-tile { background: var(--cui-color-surface-bg-canvas); }
.pg-tile > .cap { background: var(--pg-panel); }
:root[data-app="device"] .pg-gallery { grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); }

/* Device frames: iPhone 15 (companion, portrait 393x852) and Nexus 7 (device, portrait 600x960). Screen = --pg-w wide. */
.pg-stage.framed { position: relative; box-sizing: content-box; width: var(--pg-w); max-width: none; background: var(--cui-color-surface-bg-canvas);
  border-style: solid; border-color: #1b1b1d; box-shadow: 0 0 0 2px #6e6d70, 0 18px 40px #0004; overflow: hidden; align-items: center; }
.pg-stage.frame-iphone { border-width: 10px; border-radius: 54px; min-height: 640px; padding: 58px 0 30px; gap: 16px; }
.pg-stage.frame-iphone > * { max-width: calc(100% - 32px); }
.pg-stage.frame-iphone::before { content: ''; position: absolute; top: 11px; left: 50%; width: 124px; height: 36px; margin-left: -62px;
  background: #000; border-radius: 20px; z-index: 5; }
.pg-stage.frame-iphone::after { content: ''; position: absolute; bottom: 8px; left: 50%; width: 136px; height: 5px; margin-left: -68px;
  background: var(--cui-color-text-default); opacity: .85; border-radius: 3px; z-index: 5; }
.pg-stage.frame-nexus { border-width: 44px 16px 44px 16px; border-radius: 28px; min-height: 700px; padding: 24px 0; gap: 24px; }
.pg-stage.frame-nexus > * { max-width: calc(100% - 48px); }
.pg-stage.frame-nexus::before { content: ''; position: absolute; top: -26px; left: 50%; width: 8px; height: 8px; margin-left: -4px;
  background: #3a3a3e; border-radius: 50%; }
.pg-stage.frame-nexus::after { content: ''; position: absolute; top: -32px; left: 50%; width: 60px; height: 4px; margin-left: -35px;
  background: #2b2b2e; border-radius: 2px; transform: translateX(34px); }

.pg-tile > .body { padding: 18px 14px; background: var(--cui-color-surface-bg-canvas); display: flex; flex-direction: column; gap: 12px; align-items: center; }

.pg-tile > .body { overflow-x: auto; }
/* inside a device frame the component sits in the middle of the screen */
.pg-stage.framed { justify-content: center; }

