/* Generative Studio (extension package). Modal chrome (backdrop,
   frame, header, selects, buttons, scrollbars) comes from the editor's
   dsm design - the dialog mounts inside #wpie-root for exactly that.
   Only studio-specific layout lives here (prefix wpiegs-). */

.wpiegs-dialog {
	display: flex;
	flex-direction: column;
	width: min( 1120px, 96vw );
	height: min( 760px, 92vh );
}

.wpiegs-body {
	display: flex;
	flex: 1;
	min-height: 0;
}

.wpiegs-view {
	position: relative;
	display: flex;
	flex: 1;
	min-width: 0;
	overflow: hidden;
	background:
		repeating-conic-gradient(
			rgba( 128, 128, 128, 0.07 ) 0 25%,
			transparent 0 50%
		)
		0 0 / 22px 22px;
}

.wpiegs-view canvas {
	margin: auto;
	border-radius: 4px;
}

#wpie-root .wpiegs-rollbtn {
	justify-content: center;
	width: 100%;
	margin-top: 8px;
}

#wpie-root .wpiegs-docbtn {
	position: absolute;
	top: 10px;
	right: 12px;
	z-index: 3;
	display: inline-flex;
	gap: 6px;
	align-items: center;
	padding: 4px 11px;
	font-size: 11px;
	color: var( --ed-text-muted, #9aa1ab );
	cursor: pointer;
	background: var( --ed-panel, #1d2126 );
	border: 1px solid var( --ed-border, #2a2f36 );
	border-radius: 20px;
}

#wpie-root .wpiegs-docbtn[aria-pressed='true'] {
	color: var( --ed-text, #e8ebf0 );
	border-color: var( --ed-accent, #3b66ff );
}

.wpiegs-side {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 320px;
	padding: 14px;
	overflow-y: auto;
	border-left: 1px solid var( --ed-border, #333a44 );
}

.wpiegs-controls {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.wpiegs-card {
	padding: 12px;
	border-radius: 10px;
	background: var( --ed-panel, #1d2126 );
	border: 1px solid var( --ed-border, #333a44 );
}

.wpiegs-card-head {
	display: flex;
	align-items: center;
	gap: 7px;
	margin-bottom: 10px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var( --ed-text-muted, #9aa1ab );
}

.wpiegs-card-body {
	display: flex;
	flex-direction: column;
	gap: 9px;
}

.wpiegs-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.wpiegs-row .dsm-label {
	flex: 0 0 94px;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpiegs-row .dsm-select {
	flex: 1;
	min-width: 0;
}

.wpiegs-row .dsm-range {
	flex: 1;
	min-width: 0;
}

.wpiegs-row.has-val .wpiegs-val {
	flex: 0 0 40px;
	text-align: right;
	font-size: 11px;
	color: var( --ed-text-muted, #9aa1ab );
}

.wpiegs-seed {
	flex: 1;
	font-size: 13px;
	font-weight: 600;
	color: var( --ed-text, #e6e9ee );
	font-variant-numeric: tabular-nums;
}

.wpiegs-dice {
	all: unset;
	cursor: pointer;
	width: 30px;
	height: 28px;
	display: grid;
	place-items: center;
	border-radius: 7px;
	color: var( --ed-text-muted, #9aa1ab );
	border: 1px solid var( --ed-border, #333a44 );
}

.wpiegs-dice:hover {
	color: var( --ed-text, #e6e9ee );
	background: rgba( 128, 148, 178, 0.14 );
}

.wpiegs-chips {
	display: flex;
	gap: 5px;
	margin: -2px 0 2px 104px;
}

.wpiegs-chip {
	width: 22px;
	height: 14px;
	border-radius: 4px;
	border: 1px solid rgba( 255, 255, 255, 0.12 );
}

.wpiegs-note {
	font-size: 11px;
	color: var( --ed-text-muted, #9aa1ab );
}

.wpiegs-card-body .ai-btn {
	width: 100%;
	justify-content: center;
}

/* Preset gallery: live-rendered mini artworks. */
.wpiegs-presets {
	display: grid;
	grid-template-columns: repeat( 4, 1fr );
	gap: 7px;
}

.wpiegs-preset {
	position: relative;
	all: unset;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	padding: 5px 3px;
	border-radius: 8px;
	border: 1px solid var( --ed-border, #333a44 );
}

.wpiegs-preset:hover {
	background: rgba( 128, 148, 178, 0.12 );
}

.wpiegs-preset canvas {
	width: 100%;
	height: auto;
	border-radius: 5px;
}

.wpiegs-preset span {
	font-size: 10px;
	color: var( --ed-text-muted, #9aa1ab );
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpiegs-rand {
	color: #7d9bff;
	border-color: rgba( 125, 155, 255, 0.4 );
}

/* Playground context menu (own div, never a native popup). */
.wpiegs-menu {
	position: absolute;
	z-index: 5;
	display: flex;
	flex-direction: column;
	min-width: 180px;
	padding: 5px;
	gap: 2px;
	border-radius: 9px;
	background: var( --ed-panel, #1d2126 );
	border: 1px solid var( --ed-border, #333a44 );
	box-shadow: 0 10px 28px rgba( 0, 0, 0, 0.45 );
}

.wpiegs-menu button {
	all: unset;
	cursor: pointer;
	padding: 7px 10px;
	border-radius: 6px;
	font-size: 12px;
	color: var( --ed-text, #e6e9ee );
}

.wpiegs-menu button:hover {
	background: rgba( 128, 148, 178, 0.16 );
}

.wpiegs-menu button:disabled {
	opacity: 0.45;
	cursor: default;
}

.wpiegs-favs {
	margin-top: 8px;
}

.wpiegs-fav-del {
	position: absolute;
	top: 2px;
	right: 4px;
	font-size: 12px;
	line-height: 1;
	padding: 2px 4px;
	border-radius: 5px;
	color: var( --ed-text-muted, #9aa1ab );
	background: var( --ed-panel, #1d2126 );
	opacity: 0.85;
}

.wpiegs-fav-del:hover {
	color: #ff7a7a;
}

.wpiegs-colorhost {
	flex: 1;
	display: flex;
}

/* The side column is a flex column with its own scroll area. Without
   this the cards keep the default flex-shrink and get SQUEEZED instead
   of overflowing, so overflow-y never triggers and the panel simply has
   no scrollbar - the content below the fold becomes unreachable.
   (Bug class from 2026-07-17, fixed in five studios then; swept across
   the family on 2026-08-01.) */
#wpie-root .wpiegs-side > * {
	flex-shrink: 0;
}
