.wp3dconf-custom-text {
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: 100%;
}

.wp3dconf-custom-text-label {
	color: var(--wp3dconf-text-dark, #1A2B1A);
	font-weight: 600;
	font-size: 14px;
	line-height: 1.2;
	overflow-wrap: anywhere;
}

.wp3dconf-custom-text-input {
	width: 100%;
	box-sizing: border-box;
	padding: 12px 14px;
	font: inherit;
	color: var(--wp3dconf-text-dark, #1A2B1A);
	background: var(--wp3dconf-bg-item, #F0F3F0);
	border: 1px solid var(--wp3dconf-border-dark, #CDD4CD);
	border-radius: 8px;
}

.wp3dconf-custom-text-input:focus {
	outline: none;
	border-color: var(--wp3dconf-primary, #5DBF56);
}

.wp3dconf-custom-text-customize {
	align-self: flex-start;
	border-radius: 8px;
}

.wp3dconf-custom-text-notice {
	padding: 10px 12px;
	font-size: 13px;
	color: var(--wp3dconf-text-dark, #1A2B1A);
	background: var(--wp3dconf-bg-item, #F0F3F0);
	border: 1px dashed var(--wp3dconf-border-dark, #CDD4CD);
	border-radius: 8px;
}

/* ---- Customize popup ---------------------------------------------------- */

.wp3dconf-custom-text-popup {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wp3dconf-custom-text-popup[hidden] {
	display: none;
}

.wp3dconf-custom-text-popup-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
}

.wp3dconf-custom-text-popup-inner {
	position: relative;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 16px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 32px);
	padding: 20px;
	overflow: auto;
	background: #fff;
	border-radius: 8px;
}

/*
 * Sizing and colour are stated rather than inherited: a bare <button> picks
 * up whatever a customer theme applies to buttons.
 */
.wp3dconf-custom-text-popup-close {
	position: absolute;
	top: 10px;
	right: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: 24px;
	line-height: 1;
	color: var(--wp3dconf-text-dark, #1A2B1A);
	background: transparent;
	border: 0;
	border-radius: 50%;
	box-shadow: none;
	cursor: pointer;
}

.wp3dconf-custom-text-popup-close:hover,
.wp3dconf-custom-text-popup-close:focus-visible {
	background: var(--wp3dconf-bg-item, #F0F3F0);
}

.wp3dconf-custom-text-popup-title {
	margin: 0;
	padding-right: 40px;
}

/* Left: preview. Right: controls. Stacks on narrow screens. */
.wp3dconf-custom-text-columns {
	display: grid;
	grid-template-columns: minmax(0, 448px) minmax(240px, 300px);
	gap: 24px;
	align-items: start;
}

.wp3dconf-custom-text-preview-col,
.wp3dconf-custom-text-controls-col {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
}

@media (max-width: 760px) {
	.wp3dconf-custom-text-columns {
		grid-template-columns: minmax(0, 1fr);
	}
}

.wp3dconf-custom-text-canvas-wrap {
	display: flex;
	justify-content: center;
}

.wp3dconf-custom-text-popup-canvas {
	max-width: 100%;
	height: auto;
	touch-action: none;
	border: 1px solid rgba(0, 0, 0, 0.1);
}

.wp3dconf-custom-text-popup-canvas.is-movable {
	cursor: grab;
}

.wp3dconf-custom-text-popup-canvas.is-movable:active {
	cursor: grabbing;
}

.wp3dconf-custom-text-popup-canvas:focus-visible {
	outline: 2px solid var(--wp3dconf-primary, #5DBF56);
	outline-offset: 2px;
}

.wp3dconf-custom-text-hint {
	margin: 0;
	font-size: 12px;
	color: var(--wp3dconf-text-muted, #6B7A6B);
}

.wp3dconf-custom-text-hint[hidden] {
	display: none;
}

.wp3dconf-custom-text-popup-controls {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.wp3dconf-custom-text-popup-control {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* A row left out by this layer. `display: flex` would otherwise beat `hidden`. */
.wp3dconf-custom-text-popup-control[hidden] {
	display: none;
}

.wp3dconf-custom-text-popup-control > label,
.wp3dconf-custom-text-popup-label {
	font-size: 13px;
	font-weight: 600;
}

.wp3dconf-custom-text-popup-row {
	display: flex;
	align-items: center;
	gap: 12px;
}

.wp3dconf-custom-text-popup-controls input[type='range'] {
	flex: 1;
	min-width: 0;
	margin: 0;
	cursor: pointer;
	accent-color: var(--wp3dconf-primary, #5DBF56);
}

.wp3dconf-custom-text-popup-number {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
	font-size: 13px;
}

.wp3dconf-custom-text-popup-controls input[type='number'] {
	box-sizing: border-box;
	width: 72px;
	height: 32px;
	margin: 0;
	padding: 0 6px;
	font-size: 13px;
	text-align: right;
	border: 1px solid var(--wp3dconf-border-dark, #CDD4CD);
	border-radius: 4px;
}

.wp3dconf-custom-text-popup-color {
	flex: 0 0 auto;
	box-sizing: border-box;
	width: 40px;
	height: 32px;
	margin: 0;
	padding: 2px;
	cursor: pointer;
	background: var(--wp3dconf-bg-item, #F0F3F0);
	border: 1px solid var(--wp3dconf-border-dark, #CDD4CD);
	border-radius: 6px;
}

.wp3dconf-custom-text-popup-font {
	box-sizing: border-box;
	width: 100%;
	height: 36px;
	padding: 0 10px;
	font: inherit;
	color: var(--wp3dconf-text-dark, #1A2B1A);
	background: var(--wp3dconf-bg-item, #F0F3F0);
	border: 1px solid var(--wp3dconf-border-dark, #CDD4CD);
	border-radius: 6px;
	cursor: pointer;
}

.wp3dconf-custom-text-align {
	display: flex;
	gap: 6px;
}

.wp3dconf-custom-text-align-btn {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 36px;
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: 18px;
	line-height: 1;
	color: var(--wp3dconf-text-dark, #1A2B1A);
	background: var(--wp3dconf-bg-item, #F0F3F0);
	border: 1px solid var(--wp3dconf-border-dark, #CDD4CD);
	border-radius: 6px;
	box-shadow: none;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.wp3dconf-custom-text-align-btn:hover,
.wp3dconf-custom-text-align-btn:focus-visible {
	border-color: var(--wp3dconf-primary, #5DBF56);
}

.wp3dconf-custom-text-align-btn[aria-pressed='true'] {
	color: var(--wp3dconf-white, #FFFFFF);
	background: var(--wp3dconf-primary, #5DBF56);
	border-color: var(--wp3dconf-primary, #5DBF56);
}

.wp3dconf-custom-text-popup-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 16px;
}

.wp3dconf-custom-text-popup-actions button {
	border-radius: 8px;
}

/* Reset is a tertiary action, away from Apply. */
.wp3dconf-custom-text-popup-reset {
	margin-right: auto;
}
