.wcpp-studio {
	border: 1px solid #d7d7d7;
	padding: 14px;
	margin: 18px 0;
	background: #fff;
}
.wcpp-studio__bar { display: flex; gap: 12px; align-items: center; }
.wcpp-price { font-weight: 700; }
.wcpp-accept { display: block; margin-top: 10px; font-size: 13px; line-height: 1.35; }
.wcpp-artwork-rights { display: block; margin-top: 8px; font-size: 13px; line-height: 1.35; }
.wcpp-modal[hidden], .wcpp-gallery-portal[hidden], .wcpp-customizer-portal[hidden], .wcpp-viewer-frame [hidden], .wcpp-viewer-stage [hidden] { display: none !important; }
.wcpp-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0, 0, 0, .66);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px;
}
.wcpp-modal__shell {
	background: #f7f7f7;
	width: min(1180px, 96vw);
	height: min(820px, 94vh);
	display: flex;
	flex-direction: column;
	border-radius: 8px;
	overflow: hidden;
}
.wcpp-workspace { display: grid; grid-template-columns: minmax(320px, 520px) 1fr; gap: 0; min-height: 0; flex: 1; }
.wcpp-panel { min-width: 0; min-height: 0; padding: 14px; }
.wcpp-panel--tools { background: #fff; border-right: 1px solid #ddd; display: flex; flex-direction: column; }
.wcpp-panel--viewer { display: flex; flex-direction: column; background: #ececec; }
.wcpp-surface-tabs, .wcpp-tools, .wcpp-color-swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.wcpp-surface-tabs button, .wcpp-tools button, .wcpp-color-swatches button {
	border: 1px solid #c7c7c7;
	background: #fff;
	border-radius: 6px;
	padding: 7px 10px;
	cursor: pointer;
}
.wcpp-surface-tabs button.is-active { background: #111; color: #fff; }
.wcpp-color-swatches button { width: 34px; height: 28px; padding: 0; }
.wcpp-canvas { width: 100%; aspect-ratio: 3 / 4; border: 1px solid #ccc; background: #fff; touch-action: none; }
.wcpp-qc { font-size: 12px; line-height: 1.35; max-height: 150px; overflow: auto; margin-top: 8px; }
.wcpp-qc .bad { color: #9f1d1d; font-weight: 700; }
.wcpp-qc .warn { color: #8a5a00; }
.wcpp-qc .ok { color: #116c2f; }
.wcpp-modal__footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 14px; background: #fff; border-top: 1px solid #ddd; }

.wcpp-viewer-frame { width: 100%; min-width: 0; }
.wcpp-viewer-stage {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	min-height: 320px;
	overflow: hidden;
	background: #e9eaec;
	border: 1px solid #d1d4d8;
	border-radius: 8px;
}
.wcpp-viewer, .wcpp-viewer-poster {
	display: block;
	width: 100%;
	height: 100%;
	position: absolute;
	inset: 0;
}
.wcpp-viewer { min-height: 0; background: #e9eaec; touch-action: none; cursor: grab; }
.wcpp-viewer:active { cursor: grabbing; }
.wcpp-viewer:focus-visible { outline: 3px solid #2271b1; outline-offset: -3px; }
.wcpp-viewer-poster { object-fit: contain; background: #e9eaec; }
.wcpp-viewer.is-moving { cursor: move; }
.wcpp-view-controls { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 2; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; pointer-events: none; }
.wcpp-view-controls button { pointer-events: auto; }
.wcpp-view-control, .wcpp-view-surface { min-width: 40px; min-height: 40px; padding: 6px 10px; border: 1px solid #111; border-radius: 8px; background: #fff; color: #111; font: inherit; font-size: 14px; line-height: 1; cursor: pointer; }
.wcpp-view-control[aria-pressed="true"] { background: #111; color: #fff; }
.wcpp-view-control:focus-visible, .wcpp-view-surface:focus-visible { outline: 3px solid #2271b1; outline-offset: 2px; }
.wcpp-view-surfaces { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.wcpp-gallery-slide .wcpp-view-controls { justify-content: flex-start; right: 52px; }
.wcpp-gallery-slide .wcpp-view-control--reset { display: none; }
.wcpp-workspace .wcpp-view-surfaces, .wcpp-gallery-slide .wcpp-view-surfaces { display: none; }
.wcpp-viewer-stage.is-fullview { position: fixed; inset: 0; z-index: 2147483000; width: auto; height: auto; min-height: 0; aspect-ratio: auto; border: 0; border-radius: 0; }
.wcpp-viewer-stage.is-fullview .wcpp-view-surfaces { display: flex; }
@media (max-width: 820px) { .wcpp-view-control, .wcpp-view-surface { min-width: 44px; min-height: 44px; } }
html.wcpp-fullview-open, html.wcpp-fullview-open body { overflow: hidden; }
.wcpp-viewer-loading {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	z-index: 3;
	padding: 10px 14px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .94);
	box-shadow: 0 4px 18px rgba(0, 0, 0, .16);
	font-weight: 650;
	color: #1d2327;
}
.wcpp-viewer-message {
	position: absolute;
	left: 16px;
	right: 16px;
	bottom: 16px;
	z-index: 4;
	display: grid;
	gap: 8px;
	padding: 14px;
	background: rgba(255, 255, 255, .96);
	border: 1px solid #d63638;
	border-radius: 7px;
	color: #5b1516;
	box-shadow: 0 5px 24px rgba(0, 0, 0, .18);
}
.wcpp-viewer-message .button { justify-self: start; }
.wcpp-viewer-message__detail { font-size: 13px; line-height: 1.4; }
.wcpp-viewer-help { margin-top: 7px; color: #555; font-size: 12px; line-height: 1.4; }
.wcpp-gallery-slide { width: 100%; }
.wcpp-gallery-slide .wcpp-viewer-stage { border: 0; border-radius: 0; }
.wcpp-block-gallery-viewer, .wcpp-gallery-portal { width: min(100%, 720px); margin: 0 auto 18px; }
.wcpp-panel--viewer .wcpp-viewer-frame { flex: 1; min-height: 0; }
.wcpp-panel--viewer .wcpp-viewer-stage { height: calc(100% - 28px); min-height: 420px; aspect-ratio: auto; }

@media (max-width: 820px), (max-width: 1024px) and (max-height: 500px) {
	.wcpp-modal { padding: 0; }
	.wcpp-modal__shell { width: 100vw; height: 100dvh; border-radius: 0; }
	.wcpp-workspace { display: block; overflow-y: auto; overscroll-behavior: contain; }
	.wcpp-panel--tools { flex: none; border-right: 0; border-bottom: 1px solid #ddd; }
	.wcpp-panel--viewer { min-height: 340px; }
	.wcpp-panel--viewer .wcpp-viewer-stage, .wcpp-viewer-stage { min-height: 260px; }
	.wcpp-modal__footer { flex-shrink: 0; }
	.wcpp-viewer-message { left: 9px; right: 9px; bottom: 9px; }
}

@media (prefers-reduced-motion: reduce) {
	.wcpp-viewer, .wcpp-modal { scroll-behavior: auto; }
}

/* Keep persisted design metadata within narrow order-confirmation columns. */
.woocommerce-order .wc-item-meta, .woocommerce-order td, .woocommerce-order th { overflow-wrap: anywhere; word-break: break-word; }
.woocommerce-order table { width: 100%; table-layout: fixed; }

.wc-block-order-confirmation-totals__table { table-layout: fixed; width: 100%; }
.wc-block-order-confirmation-totals__table td, .wc-block-order-confirmation-totals__table th, .wc-block-order-confirmation-totals__table .wc-item-meta { overflow-wrap: anywhere; word-break: break-word; }

/* Narrow-screen view switch: panels remain mounted so editing state survives. */
.wcpp-view-switch { display: none; }
@media (max-width: 820px), (max-width: 1024px) and (max-height: 500px) {
	.wcpp-view-switch { display: flex; flex: none; gap: 8px; padding: 10px 14px; background: #fff; border-bottom: 1px solid #ddd; }
	.wcpp-view-button { flex: 1; min-height: 44px; padding: 10px 12px; border: 1px solid #111; border-radius: 6px; background: #fff; color: #111; font: inherit; font-weight: 700; cursor: pointer; }
	.wcpp-view-button[aria-pressed="true"] { background: #111; color: #fff; }
	.wcpp-view-button:focus-visible { outline: 3px solid #2271b1; outline-offset: 2px; }
	.wcpp-workspace[data-studio-view="artwork"] > .wcpp-panel--viewer,
	.wcpp-workspace[data-studio-view="preview"] > .wcpp-panel--tools { display: none; }
	.wcpp-workspace[data-studio-view="preview"] { display: flex; }
	.wcpp-workspace[data-studio-view="preview"] > .wcpp-panel--viewer { flex: 1; min-height: 0; width: 100%; overflow-y: auto; }
	.wcpp-workspace[data-studio-view="preview"] .wcpp-viewer-frame { display: flex; flex-direction: column; }
	.wcpp-workspace[data-studio-view="preview"] .wcpp-viewer-stage { flex: 1; height: auto; min-height: 120px; }
	.wcpp-modal__footer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

/* Keep Astra's floating page control outside the modal interaction surface. */
body:has(.wcpp-modal:not([hidden])) #ast-scroll-top { display: none !important; }
