/* Playground page (playground.html): the drop studio, the 3D viewer and the 2D inspector. Loaded after site.css; every
   colour comes from its tokens, except the viewer "stage", which is a dark neutral in both themes (like an editor
   canvas) so models and texels read the same everywhere. Classes generated by studio.js, gltf-scene.js and
   inspector.js are styled here too (prefix pg-). */

.page-playground {
	--stage: #0e0e10;
	--stage-glow: rgb(91 147 255 / 0.09);
	--stage-text: #a1a1aa;
	--stage-text-strong: #ededef;
	--stage-chip: rgb(10 10 11 / 0.62);
	--stage-line: rgb(255 255 255 / 0.1);
	--stage-accent: #8ab4ff;
	--panel-w: 300px;
}

/* --- page head: compact top bar with mode switcher + drop strip --------------------------------------------------- */

.pg-head { padding-block: clamp(24px, 3vw, 36px) 16px; }
.pg-head .container { gap: 14px; }

.pg-top {
	display: grid;
	gap: 18px;
}

.pg-head-copy {
	display: grid;
	gap: 8px;
}

.pg-title-row {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px 20px;
}

.pg-head h1 { font-size: clamp(1.75rem, 1.35rem + 1.2vw, 2.35rem); }
.pg-head .lead { max-width: 72ch; font-size: 15px; }

.pg-head #status { min-height: 1.5em; margin: 0; overflow-wrap: anywhere; }
.pg-head #status.ok,
.pg-head #status.info { color: var(--text-3); font-size: 13px; }

.pg-noscript { margin-top: 24px; }

/* --- workspace switcher + compact dropzone bar -------------------------------------------------------------------- */

.pg-bar {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: stretch;
	gap: 12px;
}

.pg-presets {
	display: inline-grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 4px;
	padding: 4px;
	border: 1px solid var(--line);
	border-radius: var(--radius-l);
	background: var(--surface);
}

button.pg-mode-btn {
	display: grid;
	gap: 2px;
	align-content: center;
	justify-content: start;
	justify-items: start;
	min-width: 0;
	min-height: 52px;
	padding: 8px 16px;
	border: 1px solid transparent;
	border-radius: 10px;
	background: transparent;
	color: var(--text-2);
	text-align: left;
	/* site.css buttons do not wrap; the sub-label must, or the two modes overlap on phones */
	white-space: normal;
}

button.pg-mode-btn:hover { background: var(--surface-2); color: var(--text); }

button.pg-mode-btn[aria-pressed='true'] {
	border-color: color-mix(in oklab, var(--accent) 45%, var(--line-2));
	background: var(--accent-soft);
	color: var(--text);
}

.pg-preset-name {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.pg-preset-meta {
	color: var(--text-3);
	font: 400 11.5px/1.2 var(--font-mono);
}

.pg-dropzone {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 18px;
	border: 1.5px dashed var(--line-2);
	border-radius: var(--radius-l);
	background: var(--surface);
	cursor: pointer;
	transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.pg-dropzone:hover,
.pg-dropzone.is-dragging {
	border-color: color-mix(in oklab, var(--accent) 70%, transparent);
	background: color-mix(in oklab, var(--accent) 5%, var(--surface));
}

.pg-dropzone:focus-visible { outline-offset: 3px; border-radius: var(--radius-l); }

.pg-dropzone-copy {
	display: grid;
	gap: 2px;
	min-width: 0;
}

.pg-dropzone-title {
	margin: 0;
	color: var(--text);
	font-size: 14.5px;
	font-weight: 600;
	letter-spacing: -0.01em;
	line-height: 1.3;
}

.pg-link {
	color: var(--accent);
	text-decoration: underline;
	text-decoration-color: color-mix(in oklab, var(--accent) 40%, transparent);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.pg-dropzone:hover .pg-link { text-decoration-color: currentColor; }
.pg-dropzone-off { display: none; margin: 0; }

.pg-dropzone-types {
	margin: 0;
	color: var(--text-3);
	font: 400 12px/1.4 var(--font-mono);
}

/* RCD1 is experimental: one visible marker in the drop zone, a small tag on each RCD1 download button */
.pg-dropzone-types .pg-nowrap { white-space: nowrap; }
.pg-dropzone-types .pg-exp { min-height: 18px; margin-inline: 2px; padding: 0 7px; font-size: 11px; vertical-align: 1px; }

.pg-exp-tag {
	margin-left: 7px;
	color: var(--warn);
	font: 500 10.5px/1 var(--font-mono);
	letter-spacing: 0.02em;
}

@media (prefers-color-scheme: light) {
	.pg-exp-tag { color: color-mix(in oklab, var(--warn) 90%, #000); }
}

.pg-blocks { flex: none; width: 36px; height: 36px; }
.pg-blocks rect { fill: var(--surface-3); transition: fill 0.35s var(--ease); }

.pg-blocks rect:nth-child(1),
.pg-blocks rect:nth-child(6),
.pg-blocks rect:nth-child(11),
.pg-blocks rect:nth-child(16) { fill: color-mix(in oklab, var(--accent) 70%, var(--surface-3)); }

.pg-dropzone:hover .pg-blocks rect,
.pg-dropzone.is-dragging .pg-blocks rect,
.pg-overlay .pg-blocks rect { fill: var(--accent); }

@media (max-width: 820px) {
	.pg-bar { grid-template-columns: minmax(0, 1fr); }
}

.pg-quick-strip {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 8px;
}

.pg-quick-strip a.chip {
	text-decoration: none;
	transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.pg-quick-strip a.chip:hover {
	border-color: color-mix(in oklab, var(--accent) 45%, var(--line-2));
	background: var(--accent-soft);
	color: var(--text);
}

.pg-quick-label {
	color: var(--text-3);
	font: 500 11.5px/1.2 var(--font-mono);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.pg-quick-sep {
	width: 1px;
	height: 16px;
	margin-inline: 4px;
	background: var(--line-2);
}

/* --- compact latest-result bar (studio.js renderStudioResult) ----------------------------------------------------- */

.pg-results { margin-top: 2px; }
.pg-results:empty { display: none; }

.pg-receipt-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	padding: 8px 12px 8px 16px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--surface);
	font-size: 13px;
}

.pg-receipt-kind {
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--accent-soft);
	color: var(--accent);
	font: 500 10.5px/1.3 var(--font-mono);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
}

.pg-receipt-name {
	color: var(--text);
	font-size: 13.5px;
	font-weight: 600;
}

.pg-receipt-inline {
	flex: 1 1 260px;
	min-width: 0;
	color: var(--text-2);
	font-variant-numeric: tabular-nums;
}

.pg-receipt-inline b { color: var(--text); font-weight: 600; }
.pg-receipt-inline b.is-accent { color: var(--accent); }

.pg-receipt-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-left: auto;
}

.pg-receipt-actions button { min-height: 28px; padding: 0 10px; font-size: 12.5px; }

.pg-figure dt {
	color: var(--text-3);
	font: 500 10.5px/1.3 var(--font-mono);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* active workspace view switching */
body[data-pg-view='3d'] #inspector,
body[data-pg-view='2d'] #gltf {
	display: none;
}

.pg-section { padding-top: 8px; }

/* --- drag-and-drop overlay (#drop-overlay, shown while body.dragging-files) ---------------------------------------- */

.pg-overlay {
	position: fixed;
	inset: 0;
	z-index: 90;
	display: grid;
	place-items: center;
	padding: 24px;
	background: color-mix(in oklab, var(--bg) 72%, transparent);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.2s var(--ease), visibility 0.2s var(--ease);
}

body.dragging-files .pg-overlay { opacity: 1; visibility: visible; }

.pg-overlay-card {
	display: grid;
	justify-items: center;
	gap: 16px;
	width: 100%;
	max-width: 440px;
	padding: 40px 32px 36px;
	border: 1.5px dashed var(--accent);
	border-radius: var(--radius-l);
	background: var(--surface);
	text-align: center;
	transform: scale(0.98);
	transition: transform 0.25s var(--ease);
}

body.dragging-files .pg-overlay-card { transform: none; }

.pg-blocks-lg { width: 60px; height: 60px; }

.pg-overlay-title {
	color: var(--text);
	font-size: 22px;
	line-height: 1.25;
	font-weight: 650;
	letter-spacing: -0.025em;
}

.pg-overlay-routes {
	display: grid;
	gap: 6px;
	margin: 0;
	font-size: 13.5px;
}

.pg-overlay-routes div { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; }
.pg-overlay-routes dt { color: var(--text-2); font-family: var(--font-mono); font-size: 12.5px; }
.pg-overlay-routes dd { margin: 0; color: var(--text); }
.pg-overlay-routes dd::before { content: '→'; margin-right: 10px; color: var(--text-3); }

/* --- tool frame shared by the 3D viewer and the 2D inspector -------------------------------------------------------- */

.pg-section .section-head { margin-bottom: clamp(24px, 3.5vw, 36px); }

.pg-tool {
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: var(--radius-l);
	background: var(--surface);
}

.pg-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	padding: 8px 10px;
	border-bottom: 1px solid var(--line);
}

.pg-toolbar:empty { display: none; }

.pg-tool-body {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--panel-w);
}

/* the stage: a dark neutral canvas frame (overrides the .viewport checkerboard); the canvas fills it */
.pg-stage {
	/* width: 100% so a stretched (taller) row never widens the stage through its aspect ratio */
	align-self: stretch;
	width: 100%;
	min-width: 0;
	aspect-ratio: 16 / 10;
	border: 0;
	border-radius: 0;
	background:
		radial-gradient(55% 60% at 50% 46%, var(--stage-glow), transparent 72%),
		var(--stage);
}

.pg-stage canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

#gltf-canvas { cursor: grab; }
#gltf-canvas:active { cursor: grabbing; }

.pg-stage-credit {
	position: absolute;
	left: 12px;
	bottom: 12px;
	max-width: calc(100% - 220px);
	margin: 0;
	padding: 5px 11px;
	border-radius: 999px;
	background: var(--stage-chip);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: var(--stage-text);
	font-size: 12px;
	line-height: 1.35;
}

.pg-stage-credit:empty { display: none; }
.pg-stage-credit a { color: var(--stage-text-strong); text-decoration-color: rgb(255 255 255 / 0.35); }
.pg-stage-credit a:hover { text-decoration-color: currentColor; }

.pg-stage-hint {
	position: absolute;
	right: 14px;
	bottom: 15px;
	margin: 0;
	color: rgb(255 255 255 / 0.5);
	font-size: 12px;
	pointer-events: none;
}

/* wheel over an idle viewer scrolls the page; this hint says how to zoom (gltf-scene.js wheelZoomGate) */
.pg-wheel-hint {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 3;
	margin: 0;
	padding: 8px 14px;
	border: 1px solid rgb(255 255 255 / 0.14);
	border-radius: 999px;
	background: rgb(10 10 11 / 0.82);
	color: rgb(255 255 255 / 0.92);
	font-size: 13px;
	font-weight: 500;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transform: translate(-50%, -50%) scale(0.98);
	transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}

.pg-wheel-hint.is-visible { opacity: 1; transform: translate(-50%, -50%); }

/* turntable on / off (gltf-scene.js wires it and removes [hidden]) */
button.pg-stage-btn {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 32px;
	min-height: 32px;
	padding: 0;
	border-color: var(--stage-line);
	background: var(--stage-chip);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: var(--stage-text);
}

button.pg-stage-btn[hidden] { display: none; }
button.pg-stage-btn:hover { border-color: rgb(255 255 255 / 0.24); background: var(--stage-chip); color: var(--stage-text-strong); }
button.pg-stage-btn[aria-pressed='true'] { color: var(--stage-accent); }
button.pg-stage-btn svg { width: 16px; height: 16px; }

/* drop hint over a viewport while files are dragged (main page drag state: .viewport.dragging) */
.drop-hint {
	position: absolute;
	inset: 10px;
	display: grid;
	place-items: center;
	border: 1.5px dashed var(--accent);
	border-radius: 12px;
	background: var(--accent-soft);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s var(--ease);
}

.drop-hint span {
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--accent);
	color: var(--accent-ink);
	font-size: 13px;
	font-weight: 600;
}

.viewport.dragging .drop-hint { opacity: 1; }

/* side panel: height: 0 + min-height: 100% keeps the stage's aspect-ratio in charge of the row height */
.pg-panel {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	align-content: start;
	min-width: 0;
	height: 0;
	min-height: 100%;
	overflow-y: auto;
	overscroll-behavior: contain;
	border-left: 1px solid var(--line);
	font-size: 13.5px;
}

.pg-panel-block {
	display: grid;
	gap: 10px;
	padding: 14px 16px;
}

.pg-panel-block + .pg-panel-block { border-top: 1px solid var(--line); }

.pg-panel-label {
	color: var(--text-3);
	font: 500 11px/1.4 var(--font-mono);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.pg-panel-title {
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: start;
	padding-block: 16px;
}

.pg-model { display: grid; gap: 3px; min-width: 0; }

.pg-model-name {
	color: var(--text);
	font-size: 16px;
	font-weight: 620;
	letter-spacing: -0.015em;
	overflow-wrap: anywhere;
}

.pg-model-meta { color: var(--text-3); font-size: 12.5px; }

.pg-badge:empty { display: none; }

.pg-badge {
	max-width: 160px;
	padding: 3px 8px;
	overflow: hidden;
	border: 1px solid color-mix(in oklab, var(--accent) 35%, transparent);
	border-radius: 999px;
	background: var(--accent-soft);
	color: var(--accent);
	font: 500 11px/1.3 var(--font-mono);
	letter-spacing: 0.02em;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* model tabs + open button (gltf-scene.js) */
.pg-tabs {
	display: flex;
	flex: 1 1 auto;
	flex-wrap: wrap;
	gap: 2px;
	min-width: 0;
}

button.pg-tab {
	min-height: 30px;
	max-width: 100%;
	padding: 0 11px;
	overflow: hidden;
	border-color: transparent;
	border-radius: 7px;
	background: transparent;
	color: var(--text-2);
	font-size: 13.5px;
	text-overflow: ellipsis;
}

button.pg-tab:hover { border-color: transparent; background: var(--surface-2); color: var(--text); }

button.pg-tab[aria-pressed='true'] {
	border-color: var(--line-2);
	background: var(--surface-3);
	color: var(--text);
}

button.pg-open { min-height: 30px; padding: 0 12px; font-size: 13px; }
.pg-toolbar > button.pg-open { margin-left: auto; }

/* segmented control (texture policy, inspector view mode) */
.pg-seg {
	display: inline-flex;
	gap: 2px;
	padding: 2px;
	border: 1px solid var(--line-2);
	border-radius: 9px;
	background: var(--bg);
}

button.pg-seg-btn {
	flex: 1 1 auto;
	min-height: 28px;
	padding: 0 10px;
	border: 1px solid transparent;
	border-radius: 7px;
	background: transparent;
	color: var(--text-2);
	font-size: 13px;
}

button.pg-seg-btn:hover { border-color: transparent; background: var(--surface-2); color: var(--text); }

button.pg-seg-btn[aria-pressed='true'] {
	border-color: var(--line-2);
	background: var(--surface-3);
	color: var(--text);
}

.pg-policy { display: grid; gap: 10px; }
.pg-policy .pg-seg { display: flex; }

.pg-policy-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

button.pg-switch {
	gap: 9px;
	min-height: 28px;
	padding: 0 2px;
	border: 0;
	background: transparent;
	color: var(--text-2);
	font-size: 13px;
}

button.pg-switch:hover { background: transparent; color: var(--text); }

.pg-switch-track {
	position: relative;
	width: 28px;
	height: 16px;
	border: 1px solid var(--line-2);
	border-radius: 999px;
	background: var(--surface-3);
	transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.pg-switch-track::after {
	content: '';
	position: absolute;
	top: 1px;
	left: 1px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--text-3);
	transition: transform 0.2s var(--ease), background-color 0.2s var(--ease);
}

button.pg-switch[aria-pressed='true'] .pg-switch-track { border-color: transparent; background: var(--accent); }
button.pg-switch[aria-pressed='true'] .pg-switch-track::after { background: #ffffff; transform: translateX(12px); }

button.pg-replay { min-height: 28px; padding: 0 11px; font-size: 13px; }

/* pipeline steps (gltf-scene.js) */
.pg-steps {
	display: grid;
	margin: 0;
	padding: 0;
	list-style: none;
}

.pg-step {
	position: relative;
	display: grid;
	grid-template-columns: 14px minmax(0, 1fr) auto;
	align-items: baseline;
	gap: 10px;
	padding-block: 5px;
}

.pg-step + .pg-step::before {
	content: '';
	position: absolute;
	top: -7px;
	left: 6px;
	width: 1px;
	height: 14px;
	background: var(--line-2);
}

.pg-step-dot {
	width: 9px;
	height: 9px;
	justify-self: center;
	border: 1.5px solid var(--text-3);
	border-radius: 50%;
	background: var(--surface);
	transform: translateY(1px);
}

.pg-step.is-active .pg-step-dot { border-color: var(--accent); background: var(--accent); animation: pulse 1.4s var(--ease) infinite; }
.pg-step.is-done .pg-step-dot { border-color: var(--ok); background: var(--ok); }

.pg-step-title { color: var(--text-2); }
.pg-step.is-active .pg-step-title,
.pg-step.is-done .pg-step-title { color: var(--text); }

.pg-step-meta {
	color: var(--text-3);
	font: 400 12px/1.4 var(--font-mono);
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.pg-step.is-done .pg-step-meta { color: var(--text-2); }

/* result of the 3D panel (gltf-scene.js): the saving as the key figure, then a few rows */
.pg-stats { display: grid; margin: 0; }

.pg-stat-key {
	display: grid;
	gap: 2px;
	align-content: start;
	padding-bottom: 10px;
}

.pg-stat-key dt { color: var(--text-3); font-size: 12.5px; }
.pg-stat-key dd { display: grid; gap: 3px; margin: 0; }

.pg-stat-value {
	color: var(--text);
	font-size: 28px;
	font-weight: 650;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.035em;
	line-height: 1.1;
}

.pg-stat-key.is-accent .pg-stat-value { color: var(--accent); }

.pg-stat-sub {
	color: var(--text-3);
	font-size: 12.5px;
	line-height: 1.45;
	font-variant-numeric: tabular-nums;
	overflow-wrap: anywhere;
}

.pg-stat-key + .pg-stat { border-top: 1px solid var(--line); padding-top: 8px; }

.pg-stat {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding-block: 4px;
}

.pg-stat dt { flex: none; color: var(--text-3); }

.pg-stat dd {
	margin: 0;
	color: var(--text);
	font: 400 12.5px/1.45 var(--font-mono);
	font-variant-numeric: tabular-nums;
	text-align: right;
	overflow-wrap: anywhere;
}

.pg-stat.is-accent dd { color: var(--accent); font-weight: 600; }

/* notes under the 3D tool (#gltf-timeline) */
.pg-after {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 8px;
	margin-top: 14px;
}

.pg-after:empty { display: none; }

/* collapsible texture table (#gltf-table) and inspector advanced options */
.pg-details {
	margin-top: 16px;
	border: 1px solid var(--line);
	border-radius: var(--radius-l);
	background: var(--surface);
	overflow: hidden;
}

.pg-details-summary {
	padding: 12px 18px;
	color: var(--text-2);
	font-size: 13.5px;
	font-weight: 500;
	cursor: pointer;
}

.pg-details-summary:hover { color: var(--text); }
.pg-details[open] .pg-details-summary { border-bottom: 1px solid var(--line); color: var(--text); }
.pg-details .pg-table { padding: 8px 16px 14px; }

/* nothing to list yet (or no WebGPU): hide the block rather than show an empty heading */
.pg-subsection:has(.pg-table:empty) { display: none; }

.pg-adv {
	margin-left: auto;
}

.pg-adv > summary {
	display: inline-flex;
	align-items: center;
	min-height: 30px;
	padding: 0 11px;
	border: 1px solid var(--line-2);
	border-radius: 7px;
	color: var(--text-2);
	font-size: 12.5px;
	font-weight: 500;
	cursor: pointer;
	list-style: none;
}

.pg-adv > summary::-webkit-details-marker { display: none; }
.pg-adv > summary:hover { background: var(--surface-2); color: var(--text); }
.pg-adv[open] > summary { background: var(--surface-3); color: var(--text); }

.pg-adv-fields {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid var(--line);
}

.pg-table table { font-size: 13px; }
.pg-table th,
.pg-table td { white-space: nowrap; }
.pg-table td { padding-block: 8px; vertical-align: middle; }
.pg-table td:first-child { color: var(--text); }
/* slot and format read as plain mono text, not chips (like the other tables on the site) */
.pg-table code { padding: 0; border: 0; background: none; color: var(--text); font-size: 12.5px; }

/* a wide table scrolls sideways on phones: an edge shade shows there is more (it fades out at either end) */
.pg-table .table-scroll {
	background:
		linear-gradient(to right, var(--bg) 30%, transparent) left center / 32px 100% no-repeat local,
		linear-gradient(to left, var(--bg) 30%, transparent) right center / 32px 100% no-repeat local,
		radial-gradient(farthest-side at 0 50%, var(--line-2), transparent) left center / 12px 100% no-repeat scroll,
		radial-gradient(farthest-side at 100% 50%, var(--line-2), transparent) right center / 12px 100% no-repeat scroll;
}

/* the per-texture .ktx2 download: a quiet text button, so the table's figures stay the loudest column */
button.pg-mini {
	min-height: 0;
	padding: 0 2px;
	border: 0;
	border-radius: 4px;
	line-height: 1.4;
	background: transparent;
	color: var(--text-2);
	font-size: 12.5px;
	text-decoration: underline;
	text-decoration-color: color-mix(in oklab, currentColor 30%, transparent);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

button.pg-mini:hover { border-color: transparent; background: transparent; color: var(--text); text-decoration-color: currentColor; }

/* --- 2D inspector ------------------------------------------------------------------------------------------------- */

.pg-toolbar-stack {
	display: grid;
	gap: 0;
	padding: 0;
}

.pg-tool-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	align-items: center;
	gap: 10px;
	padding: 9px 12px 9px 16px;
}

.pg-tool-row + .pg-tool-row { border-top: 1px solid var(--line); }

.pg-row-fields {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	min-width: 0;
}

.pg-row-fields > * { min-width: 0; max-width: 100%; }

.pg-toolbar .field { gap: 7px; font-size: 12.5px; }
.pg-toolbar .field > span { color: var(--text-3); }

.pg-toolbar select {
	min-width: 0;
	max-width: 100%;
	min-height: 30px;
	padding-left: 10px;
	font-size: 13px;
}

#inspector-source { max-width: 210px; }

.pg-range input[type='range'] { width: 92px; }

.pg-range .small {
	min-width: 5ch;
	color: var(--text-2);
	font: 400 12px/1 var(--font-mono);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.pg-stage-2d { aspect-ratio: 1 / 1; }

#inspector-canvas { cursor: grab; touch-action: pan-y; }
#inspector-canvas:active { cursor: grabbing; }

/* corner tags that follow the view mode (inspector.js sets data-mode on the viewport) */
.pg-tag {
	position: absolute;
	top: 10px;
	display: none;
	padding: 3px 9px;
	border-radius: 999px;
	background: var(--stage-chip);
	color: var(--stage-text-strong);
	font: 500 11px/1.4 var(--font-mono);
	letter-spacing: 0.04em;
	pointer-events: none;
}

.pg-tag-a,
.pg-tag-err { left: 10px; }
.pg-tag-b,
.pg-tag-scale { right: 10px; }

.pg-tag-scale {
	align-items: center;
	gap: 6px;
}

.pg-heat-bar {
	display: inline-block;
	width: 72px;
	height: 7px;
	border-radius: 999px;
	background: linear-gradient(90deg, #070712 0%, #290a5c 20%, #781c6d 42%, #cf4446 64%, #fa9b05 84%, #fcffa4 100%);
}

[data-mode='split'] .pg-tag-a,
[data-mode='split'] .pg-tag-b,
[data-mode='original'] .pg-tag-a,
[data-mode='compressed'] .pg-tag-b,
[data-mode='error'] .pg-tag-err { display: block; }
[data-mode='error'] .pg-tag-scale { display: inline-flex; }

[data-mode='compressed'] .pg-tag-b { right: auto; left: 10px; }

/* receipt panel (#inspector-info, inspector.js renderInfo) */
.pg-receipt { transition: opacity 0.2s var(--ease); }
.pg-receipt.is-busy { opacity: 0.5; }
.pg-receipt > .note { padding: 16px; }

.pg-receipt:empty::before {
	content: 'The receipt appears after the first encode.';
	padding: 16px;
	color: var(--text-3);
	font-size: 13.5px;
}

.pg-receipt-top {
	display: grid;
	gap: 2px;
	padding: 12px 16px 10px;
}

.pg-receipt-format {
	color: var(--text);
	font-size: 24px;
	font-weight: 650;
	letter-spacing: -0.03em;
	line-height: 1.15;
}

.pg-receipt-gpu {
	color: var(--text-3);
	font: 400 12px/1.4 var(--font-mono);
	overflow-wrap: anywhere;
}

.pg-figures {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin: 0;
	border-block: 1px solid var(--line);
}

.pg-figure {
	display: grid;
	gap: 3px;
	align-content: start;
	padding: 10px 16px;
}

.pg-figure:nth-child(odd) { border-right: 1px solid var(--line); }
.pg-figure:nth-child(n + 3) { border-top: 1px solid var(--line); }

.pg-figure dd { display: grid; gap: 1px; margin: 0; }

.pg-figure-value {
	color: var(--text);
	font-size: 18px;
	font-weight: 650;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.035em;
	line-height: 1.25;
}

.pg-figure-sub {
	color: var(--text-3);
	font-size: 11.5px;
	font-variant-numeric: tabular-nums;
	overflow-wrap: anywhere;
}

.pg-figure.is-accent .pg-figure-sub { color: var(--accent); }

.pg-receipt .table-scroll { padding: 6px 16px 8px; }

.pg-receipt table.kv thead {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.pg-receipt table.kv td { padding-block: 4.5px; border-bottom-color: var(--line); font-size: 12.5px; line-height: 1.35; }
.pg-receipt table.kv td:first-child { color: var(--text-3); white-space: nowrap; }

.pg-receipt table.kv td:last-child {
	color: var(--text);
	font-family: var(--font-mono);
	font-size: 12px;
	text-align: right;
	overflow-wrap: anywhere;
}

.pg-receipt-foot {
	display: grid;
	gap: 8px;
	padding: 12px 16px 14px;
	border-top: 1px solid var(--line);
}

.pg-receipt-foot button { width: 100%; }
.pg-receipt-note { color: var(--text-3); font-size: 12px; line-height: 1.5; }

/* --- what you are seeing ------------------------------------------------------------------------------------------ */

.pg-explain {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	margin: 0;
	padding: 0;
	border-top: 1px solid var(--line);
	list-style: none;
	counter-reset: pg-step;
}

.pg-explain li {
	display: grid;
	gap: 10px;
	align-content: start;
	padding: 24px 28px 8px 0;
	counter-increment: pg-step;
}

.pg-explain li + li { padding-left: 28px; border-left: 1px solid var(--line); }

.pg-explain li::before {
	content: counter(pg-step, decimal-leading-zero);
	color: var(--text-3);
	font: 500 12px/1 var(--font-mono);
	letter-spacing: 0.04em;
}

.pg-explain p { color: var(--text-2); font-size: 15px; }
.pg-next { margin-top: clamp(32px, 4vw, 44px); }

/* phones: the secondary link wraps under the main button with no side padding, flush with the text edge (as the
   closing .page-next of the other pages) */
@media (max-width: 640px) {
	.pg-next { column-gap: 28px; }
	.pg-next .btn-ghost { padding-inline: 0; }
	.pg-next .btn-ghost:hover { background: none; }
}

/* --- unavailable: no WebGPU, or a section could not start ----------------------------------------------------------
   studio.js sets pg-off-3d / pg-off-2d on <body> for the section that did not start, and pg-off when neither did. The
   stage then says why, the empty panel and the hints go, and the drop zone and samples are switched off. */

.pg-stage-off { display: none; }

.pg-off-3d #gltf .pg-panel,
.pg-off-3d #gltf .pg-stage-hint,
.pg-off-3d #gltf .pg-stage-btn,
.pg-off-2d #inspector .pg-panel,
.pg-off-2d #inspector .pg-tag { display: none; }

.pg-off-3d #gltf .pg-tool-body,
.pg-off-2d #inspector .pg-tool-body { grid-template-columns: minmax(0, 1fr); }

.pg-off-3d #gltf .pg-stage,
.pg-off-2d #inspector .pg-stage {
	aspect-ratio: auto;
	min-height: clamp(240px, 28vw, 340px);
}

.pg-off-3d #gltf .pg-stage-off,
.pg-off-2d #inspector .pg-stage-off {
	position: absolute;
	inset: 0;
	display: grid;
	place-content: center;
	justify-items: center;
	gap: 8px;
	padding: 24px;
	color: var(--stage-text);
	font-size: 14.5px;
	text-align: center;
}

.pg-stage-off p { max-width: 46ch; }

.pg-stage-off .pg-stage-off-title {
	color: var(--stage-text-strong);
	font-size: 17px;
	font-weight: 600;
	letter-spacing: -0.015em;
}

.pg-stage-off a { color: var(--stage-text-strong); text-decoration-color: rgb(255 255 255 / 0.4); }
.pg-stage-off a:hover { text-decoration-color: currentColor; }

.pg-off .pg-dropzone { cursor: default; pointer-events: none; }
.pg-off .pg-dropzone > :not(.pg-dropzone-off) { opacity: 0.45; }
.pg-off .pg-dropzone-sub { display: none; }
.pg-off .pg-dropzone-off { display: block; color: var(--text-2); font-size: 14.5px; }
.pg-off .pg-overlay { display: none; }

/* --- responsive --------------------------------------------------------------------------------------------------- */

@media (max-width: 960px) {
	.pg-tool-body { grid-template-columns: minmax(0, 1fr); }
	.pg-panel { height: auto; min-height: 0; overflow-y: visible; border-top: 1px solid var(--line); border-left: 0; }
	.pg-stage { aspect-ratio: 4 / 3; }
	.pg-stage-2d { aspect-ratio: 1 / 1; }

	/* the 3D panel: blocks side by side where there is room */
	.pg-tool-body > aside.pg-panel:not(.pg-receipt) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.pg-tool-body > aside.pg-panel:not(.pg-receipt) .pg-panel-title { grid-column: 1 / -1; }
	.pg-tool-body > aside.pg-panel:not(.pg-receipt) .pg-panel-block:nth-child(3) { border-top: 1px solid var(--line); }
	.pg-tool-body > aside.pg-panel:not(.pg-receipt) .pg-panel-block:nth-child(odd):not(.pg-panel-title) { border-left: 1px solid var(--line); }

	/* Result spans the row: the key figure on the left, its rows on the right */
	.pg-tool-body > aside.pg-panel:not(.pg-receipt) .pg-panel-block:last-child { grid-column: 1 / -1; border-left: 0; }

	.pg-stats {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
		align-items: start;
		column-gap: 32px;
	}

	.pg-stat-key { grid-row: span 3; padding-bottom: 0; }
	.pg-stat-key + .pg-stat { border-top: 0; padding-top: 4px; }
}

@media (max-width: 860px) {
	.pg-explain { grid-template-columns: minmax(0, 1fr); }
	.pg-explain li { padding: 22px 0 18px; }
	.pg-explain li + li { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 640px) {
	.pg-tool-body > aside.pg-panel:not(.pg-receipt) { grid-template-columns: minmax(0, 1fr); }
	.pg-stats { grid-template-columns: minmax(0, 1fr); }
	.pg-stat-key { grid-row: auto; padding-bottom: 10px; }
	.pg-stat-key + .pg-stat { border-top: 1px solid var(--line); padding-top: 8px; }
	.pg-tool-body > aside.pg-panel:not(.pg-receipt) .pg-panel-block:nth-child(odd):not(.pg-panel-title) { border-left: 0; }
	.pg-stage-hint { display: none; }
	.pg-stage-credit { right: 12px; max-width: none; border-radius: 10px; }
	.pg-tool-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px 12px 14px; }

	/* toolbar fields as a two-column form: label above control */
	.pg-row-fields {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
		align-items: end;
	}

	.pg-row-fields .field { display: grid; gap: 5px; }
	/* as tall as the Open image… button beside them */
	.pg-row-fields .field select { width: 100%; min-height: 34px; }
	.pg-row-fields .field:has(#inspector-source),
	.pg-row-fields .pg-seg,
	.pg-row-fields .pg-range,
	.pg-row-fields .pg-adv { grid-column: 1 / -1; }
	.pg-row-fields .pg-adv { margin-left: 0; }
	.pg-row-fields .pg-seg { display: flex; }
	/* the four view buttons fit inside the group at 360px */
	.pg-row-fields button.pg-seg-btn { padding-inline: 6px; }
	.pg-row-fields .pg-range { grid-template-columns: 44px minmax(0, 1fr) 13ch; align-items: center; gap: 10px; }
	.pg-row-fields .pg-range .small { text-align: right; }
	.pg-row-fields .pg-range input[type='range'] { width: 100%; }
	.pg-row-fields button.pg-open { width: 100%; min-height: 34px; }
	.pg-toolbar > button.pg-open { margin-left: 0; }
	#inspector-source { max-width: 100%; }
	.pg-stage { aspect-ratio: 1 / 1; }
	.pg-receipt-stat { flex-basis: 140px; padding: 12px 16px 14px; }
	.pg-receipt-value { font-size: 19px; }
	.pg-receipt-gloss { padding-inline: 16px; }

	/* the texture table keeps what matters on a phone: slot, semantic, format, GPU memory, material and .ktx2 */
	.pg-table :is(th, td):is(:nth-child(5), :nth-child(7), :nth-child(8), :nth-child(9)) { display: none; }
}

/* touch screens: every control of the studio, the viewer and the inspector is at least 40px tall */
@media (pointer: coarse) {
	button.pg-preset,
	button.pg-tab,
	button.pg-open,
	.pg-row-fields button.pg-open,
	button.pg-seg-btn,
	button.pg-switch,
	button.pg-replay,
	.pg-receipt-actions button,
	.pg-toolbar select,
	.pg-row-fields .field select { min-height: 40px; }

	.pg-range input[type='range'] { height: 40px; }
	button.pg-stage-btn { width: 40px; min-height: 40px; }
	button.pg-mini { min-height: 32px; padding-inline: 8px; }
}

/* very narrow phones: the drop-zone format list may wrap */
@media (max-width: 420px) {
	.pg-dropzone-types .pg-nowrap { white-space: normal; }
}
