/* 3D Effects Studio (extension package). Modal chrome (backdrop, frame,
   header, selects, ranges, buttons) comes from the editor's own modal
   design (dsm family) - the dialog mounts inside #wpie-root exactly for
   that. Only studio-specific layout lives here. */

.wpiefx3-dialog {
	display: flex;
	flex-direction: column;
	width: min( 1560px, 98vw );
	height: min( 860px, 94vh );
}

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

.wpiefx3-view {
	position: relative;
	display: grid;
	flex: 1;
	place-items: center;
	min-width: 0;
	overflow: hidden;
	background: #05060a;
}

/* Dark checkerboard behind the canvas in overlay mode: transparency stays
   visible, but glow previews the way it will read over a real design. */
.wpiefx3-view.is-overlay {
	background:
		repeating-conic-gradient( #14161c 0 25%, #0a0c10 0 50% )
		0 0 / 22px 22px;
}

/* "Show document": the rendered document sits as CSS background exactly in
   the canvas rect (canvas is letterboxed to the doc aspect, the capture has
   the doc aspect too, so 100%/100% is distortion-free). The transparent
   WebGL overlay composites on top of it in the browser. */
.wpiefx3-view.is-doc {
	background: #05060a;
}

.wpiefx3-view.is-doc canvas {
	background-repeat: no-repeat;
	background-size: 100% 100%;
}

#wpie-root .wpiefx3-docbtn {
	position: absolute;
	top: 10px;
	right: 12px;
	display: none;
	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, #333a44 );
	border-radius: 999px;
	opacity: 0.92;
}

#wpie-root .wpiefx3-view.is-overlay .wpiefx3-docbtn {
	display: inline-flex;
}

#wpie-root .wpiefx3-docbtn:hover {
	color: var( --ed-text, #e6e9ee );
}

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

.wpiefx3-docbtn svg {
	width: 13px;
	height: 13px;
}

.wpiefx3-view canvas {
	max-width: 100%;
	max-height: 100%;
	cursor: grab;
	border-radius: 4px;
}

.wpiefx3-view canvas:active {
	cursor: grabbing;
}

.wpiefx3-hint {
	position: absolute;

	/* Above the v2.14 transport bar. */
	bottom: 52px;
	left: 12px;
	padding: 3px 10px;
	font-size: 11px;
	color: var( --ed-text-muted, #9aa1ab );
	pointer-events: none;
	background: var( --ed-panel, #1d2126 );
	border-radius: 999px;
	opacity: 0.9;
}

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

.wpiefx3-seg {
	display: flex;
	flex: none;
}

.wpiefx3-seg button {
	flex: 1;
}

/* Cards. */
.wpiefx3-card {
	flex: none;
	overflow: hidden;
	background: var( --ed-panel-alt, rgba( 255, 255, 255, 0.03 ) );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 10px;
}

.wpiefx3-card-head {
	display: flex;
	gap: 8px;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px 4px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var( --ed-text-dim, #b9c0cc );
	text-transform: uppercase;
}

.wpiefx3-cardtitle {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	min-width: 0;
}

.wpiefx3-cardicon {
	display: inline-flex;
	flex: none;
	opacity: 0.85;
}

#wpie-root .wpiefx3-more {
	display: inline-flex;
	gap: 6px;
	align-items: center;
	align-self: flex-start;
	padding: 2px 0;
	font-size: 11px;
	color: var( --ed-text-muted, #9aa1ab );
	cursor: pointer;
	background: transparent;
	border: 0;
}

#wpie-root .wpiefx3-more:hover {
	color: var( --ed-text, #e8ebf0 );
}

.wpiefx3-card-body {
	display: flex;
	flex-direction: column;
	gap: 9px;
	padding: 9px 14px 13px;
}

/* Rows. */
.wpiefx3-row {
	display: flex;
	gap: 8px;
	align-items: center;
}

.wpiefx3-lbl {
	flex: none;
	width: 74px;
	overflow: hidden;
	font-size: 10.5px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

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

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

.wpiefx3-val {
	width: 26px;
	font-size: 10.5px;
	font-variant-numeric: tabular-nums;
	color: var( --ed-text-muted, #8b93a1 );
	text-align: right;
}

/* Mini icon buttons (dice, remove). */
#wpie-root .wpiefx3-mini {
	display: grid;
	flex: none;
	place-items: center;
	width: 26px;
	height: 26px;
	color: var( --ed-text-dim, #b9c0cc );
	cursor: pointer;
	background: var( --ed-panel, #14171c );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 7px;
}

#wpie-root .wpiefx3-mini:hover:not( :disabled ) {
	color: var( --accent, #3b66ff );
	border-color: var( --accent, #3b66ff );
}

#wpie-root .wpiefx3-mini:disabled {
	opacity: 0.35;
	cursor: default;
}

#wpie-root .wpiefx3-x:hover:not( :disabled ) {
	color: #ff8a80;
	border-color: #ff8a80;
}

/* Surprise tiles. */
.wpiefx3-surprise {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

#wpie-root .wpiefx3-suptile {
	display: flex;
	align-items: flex-end;
	height: 56px;
	padding: 7px 9px;
	overflow: hidden;
	cursor: pointer;
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 9px;
}

#wpie-root .wpiefx3-suptile:hover {
	border-color: var( --accent, #3b66ff );
}

#wpie-root .wpiefx3-suptile span {
	display: -webkit-box;
	overflow: hidden;
	font-size: 10px;
	font-weight: 600;
	line-height: 1.25;
	color: #fff;
	text-align: left;
	text-shadow: 0 1px 4px rgba( 0, 0, 0, 0.8 );
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

/* Preset chips. */
.wpiefx3-presets {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

#wpie-root .wpiefx3-chip {
	padding: 5px 10px;
	font-size: 11px;
	color: var( --ed-text-dim, #b9c0cc );
	cursor: pointer;
	background: var( --ed-panel, #14171c );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 999px;
}

#wpie-root .wpiefx3-chip:hover {
	color: var( --ed-text, #e6e8ee );
	border-color: var( --accent, #3b66ff );
}

/* Effect layer boxes. */
.wpiefx3-layer {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 10px;
	background: var( --ed-panel, #14171c );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 9px;
}

.wpiefx3-layerhead {
	display: flex;
	gap: 8px;
	align-items: center;
}

#wpie-root .wpiefx3-add {
	display: inline-flex;
	gap: 7px;
	align-items: center;
	justify-content: center;
	padding: 8px 12px;
	font-size: 12px;
	color: var( --ed-text-dim, #b9c0cc );
	cursor: pointer;
	background: transparent;
	border: 1px dashed var( --ed-border, #333a44 );
	border-radius: 9px;
}

#wpie-root .wpiefx3-add:hover {
	color: var( --accent, #3b66ff );
	border-color: var( --accent, #3b66ff );
}

/* Color swatches (auto + palette). */
.wpiefx3-swatches {
	display: flex;
	gap: 6px;
	align-items: center;
}

#wpie-root .wpiefx3-swatch {
	width: 20px;
	height: 20px;
	padding: 0;
	font-size: 10px;
	font-weight: 700;
	color: var( --ed-text-dim, #b9c0cc );
	cursor: pointer;
	border: 1px solid rgba( 255, 255, 255, 0.3 );
	border-radius: 50%;
}

#wpie-root .wpiefx3-swatch.is-auto {
	background: conic-gradient( #f87171, #fbbf24, #4ade80, #38bdf8, #a78bfa, #f87171 );
	color: #0b0d10;
}

#wpie-root .wpiefx3-swatch.active {
	box-shadow: 0 0 0 2px var( --ed-bg, #14171c ), 0 0 0 4px var( --accent, #3b66ff );
}

/* Palettes. */
.wpiefx3-palettes {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
}

#wpie-root .wpiefx3-palette {
	width: 44px;
	height: 20px;
	cursor: pointer;
	border: 1px solid rgba( 255, 255, 255, 0.25 );
	border-radius: 6px;
}

#wpie-root .wpiefx3-palette.active {
	box-shadow: 0 0 0 2px var( --ed-bg, #14171c ), 0 0 0 4px var( --accent, #3b66ff );
}

.wpiefx3-loopseg {
	flex: 1;
}

#wpie-root .wpiefx3-seed {
	width: 90px;
}

.wpiefx3-colorhost {
	display: inline-flex;
	flex: none;
}

/* Per-effect custom colour swatch (v2.0.1): a free picker beside the
   auto + palette swatches, sized to match them. */
.wpiefx3-customhost {
	display: inline-flex;
	align-items: center;
	border-radius: 50%;
}

#wpie-root .wpiefx3-customhost.active {
	box-shadow: 0 0 0 2px var( --ed-bg, #14171c ), 0 0 0 4px var( --accent, #3b66ff );
}

/* Round ONLY the trigger swatch (a DIRECT child) to match the auto +
   palette swatches. It must NOT cascade into the editor's ColorPopover,
   whose buttons (swatches, mode tabs, eyedropper) live deeper in the SAME
   subtree - styling those deformed the whole editor panel (v2.0.3 fix).
   `> span > button` = the real SwatchButton trigger; `> button` = the mock. */
#wpie-root .wpiefx3-customhost > span > button,
#wpie-root .wpiefx3-customhost > button {
	width: 20px !important;
	height: 20px !important;
	min-width: 0 !important;
	padding: 0 !important;
	border-radius: 50% !important;
	border: 1px solid rgba( 255, 255, 255, 0.35 ) !important;
}

/* Spinner. */
.wpiefx3-spin {
	display: inline-block;
	width: 13px;
	height: 13px;
	margin-right: 6px;
	vertical-align: -2px;
	border: 2px solid rgba( 128, 128, 128, 0.35 );
	border-top-color: currentcolor;
	border-radius: 50%;
	animation: wpiefx3-spin 0.7s linear infinite;
}

@keyframes wpiefx3-spin {

	to {
		transform: rotate( 360deg );
	}
}

/* Favorites (v1.1). */
.wpiefx3-favwrap {
	position: relative;
	display: inline-flex;
}

#wpie-root .wpiefx3-favchip {
	padding-right: 22px;
}

#wpie-root .wpiefx3-favx {
	position: absolute;
	top: 50%;
	right: 5px;
	display: grid;
	place-items: center;
	width: 14px;
	height: 14px;
	color: var( --ed-text-muted, #8b93a1 );
	cursor: pointer;
	background: none;
	border: none;
	transform: translateY( -50% );
}

#wpie-root .wpiefx3-favx svg {
	width: 10px;
	height: 10px;
}

#wpie-root .wpiefx3-favx:hover {
	color: #ff8a80;
}

/* v1.3 additions. */
.wpiefx3-check {
	display: flex;
	gap: 8px;
	align-items: center;
	font-size: 12px;
	color: var( --ed-text-dim, #b9c0cc );
	cursor: pointer;
}

.wpiefx3-formprev {
	max-width: 64px;
	max-height: 40px;
	padding: 2px;
	object-fit: contain;
	background: var( --ed-panel, #14171c );
	border: 1px solid var( --ed-border, #333a44 );
	border-radius: 6px;
}

#wpie-root .wpiefx3-supbtn {
	display: flex;
	gap: 8px;
	align-items: center;
	justify-content: center;
	width: 100%;
}


/* --------------------- v2.13: the effects library ---------------------- */
/* The whole catalog on the left, the particle studio's pattern: family
   groups that fold, live thumbnails, a click toggles the stack. */

.wpiefx3-left {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 340px;
	min-width: 340px;
	padding: 12px;
	overflow-x: hidden;
	overflow-y: auto;
	scrollbar-gutter: stable;
	border-right: 1px solid var( --ed-border, #2a2f36 );
}

.wpiefx3-left > * {
	flex: none;
	min-width: 0;
}

.wpiefx3-libbody {
	display: flex;
	flex-direction: column;
	gap: 7px;
}

.wpiefx3-search {
	box-sizing: border-box;
	width: 100%;
}

.wpiefx3-famhead {
	display: flex;
	gap: 6px;
	align-items: center;
	width: 100%;
	padding: 3px 2px;
	margin: 6px 0 2px;
	font: inherit;
	font-size: 11px;
	color: var( --ed-text-dim, #a7adb7 );
	text-transform: uppercase;
	letter-spacing: 0.04em;
	cursor: pointer;
	background: transparent;
	border: 0;
}

.wpiefx3-chev {
	display: inline-flex;
	opacity: 0.7;
	transition: transform 0.15s;
}

.wpiefx3-famhead.is-closed .wpiefx3-chev {
	transform: rotate( -90deg );
}

.wpiefx3-famcount {
	margin-left: auto;
	opacity: 0.55;
}

.wpiefx3-libgrid {
	display: grid;
	grid-template-columns: repeat( 2, 1fr );
	gap: 6px;
}

.wpiefx3-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 5px;
	padding: 6px;
	font: inherit;
	color: inherit;
	text-align: left;
	cursor: pointer;
	background: rgba( 127, 127, 127, 0.1 );
	border: 1px solid transparent;
	border-radius: 8px;
}

.wpiefx3-tile:hover {
	background: rgba( 127, 127, 127, 0.18 );
}

.wpiefx3-tile.is-on {
	background: rgba( 59, 102, 255, 0.16 );
	border-color: #3b66ff;
}

.wpiefx3-tile-thumb {
	display: grid;
	place-items: center;
	width: 100%;
	aspect-ratio: 1;
	overflow: hidden;
	color: var( --ed-text-dim, #8b929c );
	background: #05060a;
	border-radius: 6px;
}

.wpiefx3-tile-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wpiefx3-tile-label {
	font-size: 11px;
	line-height: 1.3;
}

/* The layer number: which slot of the stack this effect occupies. */
.wpiefx3-tile-badge {
	position: absolute;
	top: 10px;
	right: 10px;
	display: grid;
	place-items: center;
	width: 18px;
	height: 18px;
	font-size: 11px;
	font-weight: 700;
	color: #fff;
	pointer-events: none;
	background: #3b66ff;
	border-radius: 50%;
}

/* v2.14: transport (play/pause + scrub) and drag-positioning. */
#wpie-root .wpiefx3-transport {
	position: absolute;
	right: 12px;
	bottom: 10px;
	left: 12px;
	z-index: 3;
	display: flex;
	gap: 10px;
	align-items: center;
	padding: 6px 10px;
	background: rgba( 0, 0, 0, 0.45 );
	border: 1px solid var( --ed-border, #3a3f47 );
	border-radius: 999px;
}

#wpie-root .wpiefx3-playbtn {
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	padding: 0;
	color: var( --ed-text, #e8ecf1 );
	cursor: pointer;
	background: rgba( 127, 127, 127, 0.18 );
	border: 0;
	border-radius: 50%;
}

#wpie-root .wpiefx3-playbtn:hover {
	background: var( --accent, #3b66ff );
}

#wpie-root .wpiefx3-scrub {
	flex: 1;
	min-width: 0;
}

#wpie-root .wpiefx3-time {
	flex: none;
	min-width: 74px;
	font-size: 11px;
	color: var( --ed-text-dim, #c3c9d3 );
	font-variant-numeric: tabular-nums;
	text-align: right;
}

#wpie-root .wpiefx3-movebtn.active {
	color: #fff;
	background: var( --accent, #3b66ff );
}

.wpiefx3-view.is-move canvas {
	cursor: move;
}
