/* DC Blueprints · Playground: the editor shell and the canvas renderers. Values come from tokens.css. */

/* The editor fills the window under the header; only the canvas and the panels scroll. */
.pg-body { overflow: hidden; }
.pg-main { display: flex; flex-direction: column; height: calc(100vh - 64px); height: calc(100dvh - 64px); padding: 0; }

/* ---------- Toolbar ---------- */
.pg-toolbar { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-3); padding: var(--s-2) clamp(16px, 2vw, 24px); border-bottom: 1px solid var(--border); background: var(--background); position: relative; z-index: 12; }
.pg-toggle { position: relative; }
.pg-toggle[aria-pressed="true"] { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--foreground); }
.pg-tcount { position: absolute; top: -4px; right: -4px; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-pill); background: var(--destructive); color: var(--background); font: 700 11px var(--font); font-variant-numeric: tabular-nums; }
.pg-tcount.warn { background: var(--warning); }
.pg-group { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.pg-seg { margin: 0; }
.pg-select { height: 44px; max-width: 220px; padding: 0 36px 0 var(--s-4); border: 0; border-radius: var(--r-pill); background: var(--card); color: var(--foreground); font: 600 15px var(--font); box-shadow: inset 0 0 0 1px var(--border); appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; text-overflow: ellipsis; }
.pg-select:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
.pg-ib[disabled] { opacity: 0.4; cursor: not-allowed; }
.pg-menu { left: auto; right: 0; transform-origin: top right; }
.pg-menu .danger { color: var(--destructive); }
/* ---------- Workspace: full-size canvas with floating panels ---------- */
.pg-work { --gutter: 16px; --left-w: 280px; --right-w: 330px; position: relative; flex: 1; min-height: 0; }
.pg-canvas { position: absolute; inset: 0; }
.pg-panel { position: absolute; top: var(--gutter); z-index: 10; display: flex; flex-direction: column; gap: var(--s-3); width: var(--left-w); max-height: calc(100% - var(--gutter) * 2 - 44px); padding: var(--s-2) var(--s-3) var(--s-3); border-radius: var(--r-xl); background: var(--card); box-shadow: var(--edge), var(--shadow-lift); overflow: hidden; }
.pg-left { left: var(--gutter); }
.pg-right { right: var(--gutter); width: var(--right-w); }
.pg-panel.moved { left: var(--x); top: var(--y); right: auto; max-height: calc(100% - var(--y) - var(--gutter)); }
.pg-panel.dragging { user-select: none; box-shadow: var(--edge), 0 40px 80px -24px rgba(0, 0, 0, 0.45); }
.pg-phead { flex: none; display: flex; align-items: center; gap: var(--s-1); margin-inline: calc(var(--s-1) * -1); cursor: grab; touch-action: none; }
.pg-panel.dragging .pg-phead { cursor: grabbing; }
.pg-grip { flex: none; width: 10px; height: 20px; margin-left: 2px; background-image: radial-gradient(currentColor 1.2px, transparent 1.4px); background-size: 5px 5px; color: var(--muted-foreground); opacity: 0.7; }
.pg-phead .pg-tabs { flex: 1; min-width: 0; }
.pg-close { flex: none; box-shadow: none; }
.pg-close:hover { background: var(--surface-2); box-shadow: none; }
.pg-tabs [role="tablist"] { display: flex; width: 100%; }
.pg-tabs [role="tab"] { flex: 1; padding: 0 var(--s-3); }
.pg-pane { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--s-1) var(--s-2); }
.pg-status { position: absolute; left: 50%; bottom: 12px; z-index: 9; display: flex; gap: var(--s-2); max-width: calc(100% - 32px); padding: 6px var(--s-4); border-radius: var(--r-pill); background: var(--popover); box-shadow: var(--edge); transform: translateX(-50%); font-size: 13px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.pg-status > * + span::before { content: "·"; margin-right: var(--s-2); }
.pg-saved.bad { color: var(--destructive); font-weight: 600; }

/* ---------- Right-click menu ---------- */
.pg-ctx { position: fixed; top: 0; left: 0; z-index: 60; min-width: 240px; max-height: calc(100vh - 16px); overflow-y: auto; transform-origin: top left; }
.pg-ctx [role="menuitem"] { height: 36px; justify-content: space-between; }
.pg-ctx [role="menuitem"][aria-disabled="true"] { color: var(--muted-foreground); opacity: 0.55; cursor: default; }
.pg-ctx [role="menuitem"][aria-disabled="true"]:hover { background: transparent; }
.pg-ctx .danger { color: var(--destructive); }
.pg-ctx kbd { font: 500 12px var(--font); color: var(--muted-foreground); }
.pg-ctx [role="separator"] { height: 1px; margin: var(--s-1) var(--s-2); background: var(--border); }
.pg-ctx .pg-ctx-title { padding: var(--s-2) var(--s-3) var(--s-1); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.pg-help { margin-bottom: var(--s-3); font-size: 13px; line-height: 1.5; color: var(--muted-foreground); }
.pg-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 4px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.pg-count.has { background: var(--destructive); color: var(--background); }
.pg-count.warn { background: var(--warning); color: var(--background); }

/* Palette */
.pg-pal-group + .pg-pal-group { margin-top: var(--s-4); }
.pg-pal-group h3 { margin-bottom: var(--s-2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-foreground); }
.pg-pal { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.pg-pal button { display: grid; gap: 2px; min-height: 56px; padding: var(--s-2) var(--s-3); border: 0; border-radius: var(--r-md); background: var(--popover); color: var(--foreground); font: 600 14px var(--font); text-align: left; cursor: grab; box-shadow: var(--edge); transition: box-shadow 150ms var(--ease-out), transform 160ms var(--ease-out); }
.pg-pal button:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.pg-pal button:active { transform: scale(0.97); }
.pg-pal small { font-size: 12px; font-weight: 500; line-height: 1.3; color: var(--muted-foreground); }

/* Layers */
.pg-layers { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.pg-layers button { display: flex; align-items: center; gap: var(--s-2); width: 100%; min-height: 36px; padding: 4px var(--s-2); border: 0; border-radius: 8px; background: transparent; color: var(--foreground); font: 500 14px var(--font); text-align: left; cursor: pointer; }
.pg-layers button:hover { background: var(--surface-2); }
.pg-layers button[aria-current="true"] { background: var(--popover); box-shadow: inset 2px 0 0 var(--accent-line), var(--edge); }
.pg-layers b { flex: none; font-weight: 700; }
.pg-layers span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-foreground); }
.pg-layers .flag { flex: none; width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: var(--destructive); }
.pg-layers .flag.warn { background: var(--warning); }

/* Inspector */
.pg-insp-head { display: grid; gap: 2px; margin-bottom: var(--s-4); }
.pg-insp-head h3 { font-size: 18px; }
.pg-insp-head span { font-size: 13px; color: var(--muted-foreground); }
.pg-props { display: grid; gap: var(--s-4); }
.pg-prop { display: grid; gap: 6px; }
.pg-prop > label, .pg-prop > span { font-size: 13px; font-weight: 600; }
.pg-prop .input { height: 44px; font-size: 16px; }
.pg-prop textarea.input { height: auto; min-height: 96px; padding: var(--s-2) var(--s-3); resize: vertical; line-height: 1.5; }
.pg-prop select.input { padding-right: 36px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.pg-check { display: flex; align-items: flex-start; gap: var(--s-2); min-height: 44px; padding-top: 10px; font-size: 14px; font-weight: 500; cursor: pointer; }
.pg-check input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }
.pg-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.pg-insp-issues { display: grid; gap: var(--s-2); margin: 0 0 var(--s-4); padding: 0; list-style: none; }
.pg-insp-issues li { padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--popover); font-size: 13px; line-height: 1.45; box-shadow: inset 3px 0 0 var(--destructive); }
.pg-insp-issues li.warn { box-shadow: inset 3px 0 0 var(--warning); }

/* Checks */
.pg-issues { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.pg-issue { display: grid; gap: 4px; padding: var(--s-3); border-radius: var(--r-md); background: var(--popover); box-shadow: inset 3px 0 0 var(--destructive), var(--edge); }
.pg-issue.warn { box-shadow: inset 3px 0 0 var(--warning), var(--edge); }
.pg-issue button { padding: 0; border: 0; background: none; color: var(--foreground); font: 600 14px/1.45 var(--font); text-align: left; cursor: pointer; }
.pg-issue button:hover { text-decoration: underline; text-underline-offset: 3px; }
.pg-issue .meta { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; font-size: 12px; color: var(--muted-foreground); }
.pg-issue .sev { font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--destructive); }
.pg-issue.warn .sev { color: var(--warning); }
.pg-issue a { color: var(--accent-text); font-weight: 600; text-underline-offset: 3px; }
.pg-allgood { padding: var(--s-4); border-radius: var(--r-md); background: var(--popover); font-size: 14px; font-weight: 600; color: var(--success); }
.pg-built { margin-top: var(--s-5); font-size: 14px; }
.pg-built summary { min-height: 44px; display: flex; align-items: center; gap: var(--s-2); font-weight: 600; cursor: pointer; list-style: none; }
.pg-built summary::-webkit-details-marker { display: none; }
.pg-built summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 200ms var(--ease-out); }
.pg-built[open] summary::before { transform: rotate(45deg); }
.pg-built .rules li { font-size: 14px; }

/* ---------- Canvas ---------- */
.pg-stage { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; padding: 60px var(--gutter) 72px; background: var(--surface-2); background-image: radial-gradient(var(--border-strong) 1px, transparent 1px); background-size: 16px 16px; }
/* Open panels that sit in their usual place push the screen over, so it is never hidden under them. */
.pg-work.left-docked .pg-stage { padding-left: calc(var(--left-w) + var(--gutter) * 2); }
.pg-work.right-docked .pg-stage { padding-right: calc(var(--right-w) + var(--gutter) * 2); }
/* The sizer takes the frame's zoomed size so the stage scrolls correctly at any zoom; the scaler zooms the frame inside it. */
.pg-sizer { position: relative; margin: 0 auto; }
.pg-scaler { position: absolute; top: 0; left: 0; transform-origin: top left; }
.pg-stage.pan-ready, .pg-stage.pan-ready .pg-frame [data-id] { cursor: grab; }
.pg-stage.panning, .pg-stage.panning .pg-frame [data-id] { cursor: grabbing; }

/* Name tags, the selection toolbar and the breadcrumb */
.pg-tag { position: absolute; z-index: 6; max-width: 240px; padding: 2px 8px; border-radius: 6px; background: var(--accent-line); color: var(--ink); font: 700 11px/16px var(--font); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.pg-hover-tag { background: var(--popover); color: var(--foreground); box-shadow: var(--edge); }
.pg-seltools { position: absolute; z-index: 7; display: flex; gap: 2px; padding: 3px; border-radius: var(--r-md); background: var(--popover); box-shadow: var(--edge), var(--shadow-lift); }
.pg-seltools button { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--foreground); cursor: pointer; }
.pg-seltools button:hover { background: var(--surface-2); }
.pg-seltools button:disabled { opacity: 0.35; cursor: not-allowed; background: transparent; }
.pg-seltools button.danger { color: var(--destructive); }
.pg-seltools svg { width: 17px; height: 17px; }
.pg-crumbs { position: absolute; top: 10px; left: 50%; z-index: 8; max-width: calc(100% - 32px); transform: translateX(-50%); }
.pg-work.left-docked .pg-crumbs { left: calc(50% + (var(--left-w) + var(--gutter)) / 2); max-width: calc(100% - var(--left-w) - var(--right-w) - var(--gutter) * 4); }
.pg-work.left-docked:not(.right-docked) .pg-crumbs { max-width: calc(100% - var(--left-w) - var(--gutter) * 3); }
.pg-work.right-docked .pg-crumbs { left: calc(50% - (var(--right-w) + var(--gutter)) / 2); }
.pg-work.left-docked.right-docked .pg-crumbs { left: calc(50% + (var(--left-w) - var(--right-w)) / 2); }
.pg-crumbs ol { display: flex; align-items: center; gap: 2px; margin: 0; padding: 3px; list-style: none; border-radius: var(--r-pill); background: var(--popover); box-shadow: var(--edge); overflow: hidden; }
.pg-crumbs li { display: flex; align-items: center; min-width: 0; }
.pg-crumbs li + li::before { content: "›"; padding: 0 2px; color: var(--muted-foreground); }
.pg-crumbs button { min-width: 0; max-width: 160px; height: 28px; padding: 0 10px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted-foreground); font: 600 13px var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.pg-crumbs button:hover { background: var(--surface-2); color: var(--foreground); }
.pg-crumbs button[aria-current="true"] { color: var(--foreground); background: var(--surface-2); }
.pg-exit-preview { position: absolute; top: 12px; left: 50%; z-index: 11; transform: translateX(-50%); }
.pg-exit-preview kbd { padding: 0 6px; border-radius: 4px; background: color-mix(in srgb, currentColor 18%, transparent); font: 700 12px var(--font); }

/* Outlines (X-ray) and preview mode */
.pg-frame.outlines [data-id]:not(.pg-root) { outline: 1px dashed color-mix(in srgb, var(--accent-line) 70%, transparent); outline-offset: -1px; }
.pg-frame.outlines .pg-box:not(.pg-root) { background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--accent-line) 7%, transparent) 0 6px, transparent 6px 12px); }
.pg-frame.preview [data-id] { cursor: default; }
.pg-frame.preview [data-id]:hover, .pg-frame.preview .pg-sel { outline: 0 !important; }
.pg-frame.preview .pg-empty { visibility: hidden; }
.pg-main:fullscreen { height: 100vh; background: var(--background); }
.pg-main::backdrop { background: var(--background); }

/* Zoom pill, width field, placement switch */
.pg-zoom { display: inline-flex; align-items: center; gap: 2px; margin: -4px 0 -4px -10px; }
.pg-zoom button { min-width: 32px; height: 28px; padding: 0 8px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--foreground); font: 600 13px var(--font); font-variant-numeric: tabular-nums; cursor: pointer; }
.pg-zoom button:hover { background: var(--surface-2); }
.pg-zoom button[aria-pressed="true"] { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-strong); }
.pg-status { pointer-events: auto; align-items: center; }
.pg-width { display: inline-flex; align-items: center; gap: 4px; height: 44px; padding: 0 var(--s-3); border-radius: var(--r-pill); background: var(--card); box-shadow: inset 0 0 0 1px var(--border); font-size: 13px; color: var(--muted-foreground); }
.pg-width:focus-within { box-shadow: inset 0 0 0 2px var(--ring); }
.pg-width input { width: 52px; border: 0; background: transparent; color: var(--foreground); font: 600 15px var(--font); font-variant-numeric: tabular-nums; text-align: right; -moz-appearance: textfield; }
.pg-width input:focus { outline: none; }
.pg-width input::-webkit-inner-spin-button, .pg-width input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pg-view-menu { min-width: 260px; }
.pg-view-menu [role="menuitemcheckbox"], .pg-view-menu [role="menuitemradio"] { padding-left: 34px; position: relative; }
.pg-view-menu [aria-checked="true"]::before { content: ""; position: absolute; left: 14px; top: 50%; width: 5px; height: 10px; margin-top: -7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.pg-view-menu [role="menuitem"] { padding-left: 34px; }
.pg-view-menu button { justify-content: space-between; }
.pg-view-menu kbd, .pg-menu kbd { font: 500 12px var(--font); color: var(--muted-foreground); }
.pg-view-menu [role="separator"] { height: 1px; margin: var(--s-1) var(--s-2); background: var(--border); }
.pg-place { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); font-size: 13px; font-weight: 600; }
.pg-place .seg { margin: 0; flex: 1; }
.pg-place .seg button { flex: 1; height: 32px; padding: 0 var(--s-2); font-size: 13px; }
.pg-drop.lbl span { position: absolute; top: -26px; left: 50%; transform: translateX(-50%); padding: 2px 8px; border-radius: 6px; background: var(--accent-line); color: var(--ink); font: 700 11px/16px var(--font); white-space: nowrap; }
.pg-drop.v.lbl span { top: -24px; }
.pg-frame { container-type: inline-size; display: flex; flex-direction: column; min-height: 640px; overflow-x: auto; border-radius: 28px; background: var(--background); color: var(--foreground); box-shadow: var(--edge), var(--shadow-lift); font-size: 16px; line-height: 1.6; }
.pg-frame.tablet, .pg-frame.desktop { border-radius: var(--r-lg); }
.pg-drop { position: absolute; z-index: 5; height: 3px; border-radius: 2px; background: var(--accent-line); pointer-events: none; box-shadow: 0 0 0 2px var(--background); }
.pg-drop.v { width: 3px; height: auto; }
.pg-drop.into { height: auto; background: color-mix(in srgb, var(--accent-line) 14%, transparent); box-shadow: inset 0 0 0 2px var(--accent-line); border-radius: var(--r-sm); }

/* Selection and hover outlines on canvas items */
.pg-frame [data-id] { cursor: default; }
.pg-frame [data-id]:not(.pg-root):hover:not(:has([data-id]:hover)) { outline: 1px dashed var(--accent-line); outline-offset: 2px; }
.pg-frame .pg-sel { outline: 2px solid var(--accent-line) !important; outline-offset: 2px; }
.pg-frame .pg-root.pg-sel { outline: 0 !important; }
.pg-frame .pg-dragging { opacity: 0.4; }
.pg-frame { user-select: none; -webkit-user-select: none; }
.pg-frame input { pointer-events: none; }
.pg-frame .pg-empty { display: grid; place-items: center; min-height: 56px; padding: var(--s-3); border-radius: var(--r-sm); box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--muted-foreground); font-size: 13px; font-weight: 600; text-align: center; pointer-events: none; }
.pg-frame .pg-blank { min-height: 400px; }

/* Renderers: what each component looks like on the canvas (and in the HTML export). */
.pg-box { display: flex; min-width: 0; }
.pg-root { flex: 1 0 auto; }
.pg-h { overflow-wrap: anywhere; }
.pg-h1 { font-size: clamp(32px, 5cqi, 56px); line-height: 1.08; letter-spacing: -0.03em; }
.pg-h2 { font-size: clamp(24px, 3.4cqi, 36px); line-height: 1.15; }
.pg-h3 { font-size: 21px; line-height: 1.25; }
.pg-h4 { font-size: 18px; line-height: 1.3; }
.pg-text { overflow-wrap: anywhere; }
.pg-text.readable { max-width: 65ch; }
.pg-text.body { font-size: 16px; }
.pg-text.lead { font-size: 19px; line-height: 1.5; }
.pg-text.small { font-size: 14px; }
.pg-text.t-muted { color: var(--muted-foreground); }
.pg-text.t-accent { color: var(--accent-text); }
.pg-text.t-destructive { color: var(--destructive); }
.pg-box.on-primary { color: var(--primary-foreground); }
.pg-box.on-primary .pg-text.t-muted { color: color-mix(in srgb, var(--primary-foreground) 72%, transparent); }
/* Buttons, badges and eyebrows keep their own width inside a stack, lined up with the stack. */
.pg-box.col > .pg-shrink { align-self: flex-start; }
.pg-box.col.al-center > .pg-shrink { align-self: center; }
.pg-box.col.al-end > .pg-shrink { align-self: flex-end; }
.pg-box.rowx > .pg-img { flex: 1 1 160px; width: auto; }
.pg-full { max-width: none; }
.pg-img { display: grid; place-items: center; width: 100%; background: var(--surface-2); color: var(--muted-foreground); }
.pg-img svg { width: 28px; height: 28px; }
.pg-hr { width: 100%; margin: 0; border: 0; border-top: 1px solid var(--border-strong); }
.pg-te { line-height: 1.75; }
.pg-frame .btn .arrow { display: inline-block; }

/* Dark measurement copy: rules the site scopes to :root[data-theme="dark"]. */
.pg-frame.pg-theme-light .btn-danger { color: #fff; }
.pg-frame.pg-theme-dark .btn-danger { color: var(--ink); }
.pg-measure { position: absolute; top: 0; left: -100000px; visibility: hidden; pointer-events: none; }
.pg-measure .pg-frame { min-height: 0; }

/* ---------- Dialogs ---------- */
.pg-dialog { width: min(560px, calc(100vw - 32px)); }
.pg-dtitle { margin-bottom: var(--s-3); padding-right: var(--s-7); font-size: 22px; }
.pg-dialog .field { max-width: none; margin-bottom: var(--s-4); }
.pg-dialog .actions { margin-top: var(--s-4); }
.pg-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-2); margin: 0; padding: 0; border: 0; }
.pg-tpls legend { margin-bottom: var(--s-2); font-size: 14px; font-weight: 600; }
.pg-tpl { position: relative; display: grid; gap: 2px; padding: var(--s-3); border-radius: var(--r-md); background: var(--card); cursor: pointer; box-shadow: var(--edge); }
.pg-tpl:has(input:checked) { box-shadow: inset 0 0 0 2px var(--ring); }
.pg-tpl:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 3px; }
.pg-tpl input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pg-tpl b { font-size: 15px; }
.pg-tpl span { font-size: 13px; line-height: 1.4; color: var(--muted-foreground); }
dialog.pg-export { width: min(880px, calc(100vw - 32px)); }
.pg-exp-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-3); margin: var(--s-4) 0 var(--s-3); }
.pg-exp-bar .seg { margin: 0; }
.pg-code { max-height: 56vh; margin: 0; padding: var(--s-4); overflow: auto; border-radius: var(--r-md); background: var(--surface-2); font: 13px/1.6 var(--mono); white-space: pre; tab-size: 2; }
.pg-code:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.toast .pg-undo { margin-left: auto; padding: 0 var(--s-2); height: 32px; border: 0; border-radius: var(--r-pill); background: var(--surface-2); color: var(--foreground); font: 700 13px var(--font); cursor: pointer; }

/* ---------- Smaller screens ---------- */
@media (max-width: 1100px) {
  .pg-work { --left-w: 250px; --right-w: 300px; }
}
@media (max-width: 760px) {
  /* Phones: panels are bottom sheets over the canvas, one at a time, and don't drag. */
  .pg-toolbar { justify-content: flex-start; }
  .pg-select { max-width: 150px; }
  .volumes a { padding: 0 var(--s-2); }
  .pg-stage, .pg-work.left-docked .pg-stage, .pg-work.right-docked .pg-stage { padding: var(--s-4) var(--s-3) 72px; }
  .pg-panel, .pg-panel.moved { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 62%; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .pg-phead { cursor: default; }
  .pg-grip { display: none; }
  .pg-width { display: none; }
  .pg-crumbs, .pg-work.left-docked .pg-crumbs, .pg-work.right-docked .pg-crumbs { left: 50%; max-width: calc(100% - 24px); }
}
/* components.css hides switch labels on phones to save header space; the toolbar has room, and the label is the switch's name. */
.pg-group .switch .lbl { display: inline; }
