/* Pattern Generator (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 wpiepg-). */

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

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

.wpiepg-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;
}

.wpiepg-view canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

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

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

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

.wpiepg-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 );
}

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

.wpiepg-dials {
	display: flex;
	flex-direction: column;
	gap: 9px;
}

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

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

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

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

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

.wpiepg-row input[type='text'] {
	flex: 1;
	min-width: 0;
	padding: 6px 9px;
	font-size: 12px;
	color: var( --ed-text, #e6e9ee );
	background: var( --ed-bg, #14171b );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 7px;
	outline: none;
}

.wpiepg-row input[type='text']:focus {
	border-color: #3b66ff;
}

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

.wpiepg-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 );
}

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

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

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

.wpiepg-check {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	color: var( --ed-text, #e6e9ee );
	cursor: pointer;
}

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

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

.wpiepg-row .ai-btn {
	width: 100%;
	justify-content: center;
}

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

.wpiepg-preset {
	position: relative;
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	padding: 5px 3px;
	min-width: 0;
	max-width: 100%;
	border-radius: 8px;
	border: 1px solid var( --ed-border, #333a44 );
}

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

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

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

.wpiepg-rollbtn {
	justify-content: center;
	width: 100%;
	margin-top: 8px;
}

/* Playground context menu (own div, never a native popup). */
.wpiepg-menu {
	position: absolute;
	z-index: 5;
	display: flex;
	flex-direction: column;
	min-width: 190px;
	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 );
}

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

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

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

.wpiepg-stampthumb {
	flex: 0 0 34px;
	height: 34px;
	border-radius: 7px;
	border: 1px solid var( --ed-border, #333a44 );
	background-color: rgba( 128, 148, 178, 0.08 );
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
}

.wpiepg-stamprow .ai-btn {
	flex: 1;
}

.wpiepg-favbtn {
	margin-top: 8px;
}

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

.wpiepg-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;
}

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

/* 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 .wpiepg-side > * {
	flex-shrink: 0;
}
