/* PhotoPuzzleMe — puzzle creator. Uses theme tokens with fallbacks. */
.ppm-creator {
	--ppm-accent: var(--c-accent, #ff6b4a);
	--ppm-accent-dark: var(--c-accent-dark, #e8502f);
	--ppm-accent-soft: var(--c-accent-soft, #ffe2d9);
	--ppm-ink: var(--c-ink, #1f2537);
	--ppm-muted: var(--c-muted, #646a7d);
	--ppm-line: var(--c-line, #ece3d6);
	--ppm-surface: var(--c-surface, #fff);
	--ppm-soft: var(--c-soft, #fff1e4);
	--ppm-radius: var(--radius, 16px);
}

.ppm-creator [hidden] { display: none !important; }
.ppm-creator__form { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 48px; align-items: start; }
@media (max-width: 900px) { .ppm-creator__form { grid-template-columns: 1fr; gap: 28px; } }

.ppm-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Preview */
.ppm-creator__preview { position: sticky; top: 100px; }
@media (max-width: 900px) { .ppm-creator__preview { position: static; } }

.ppm-frame {
	position: relative; width: min(100%, calc(70vh * var(--ppm-aspect, 1.33))); margin: 0 auto;
	background: var(--ppm-surface); border: 8px solid #fff; border-radius: 6px;
	box-shadow: 0 24px 60px rgba(31, 37, 55, .16); overflow: hidden;
	transition: aspect-ratio .3s ease;
}
.ppm-frame.has-photo { cursor: grab; touch-action: none; user-select: none; }
.ppm-frame.is-panning { cursor: grabbing; }
.ppm-frame.is-dragging { outline: 3px dashed var(--ppm-accent); outline-offset: 4px; }
.ppm-frame__img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; max-width: none !important; transition: filter .25s; pointer-events: none; }
/* Intro animation: pieces fall into place over the photo, then fade out. */
.ppm-frame__img, .ppm-frame__jigsaw, .ppm-frame__safe { transition: opacity .35s ease; }
.ppm-frame.is-assembling .ppm-frame__img,
.ppm-frame.is-assembling .ppm-frame__jigsaw,
.ppm-frame.is-assembling .ppm-frame__safe { opacity: 0; }
.ppm-assemble { position: absolute; inset: 0; pointer-events: none; z-index: 2; transition: opacity .3s ease; }
.ppm-assemble.is-done { opacity: 0; }
.ppm-assemble__piece {
	position: absolute; background-repeat: no-repeat; border-radius: 3px;
	box-shadow: 0 8px 18px rgba(31, 37, 55, .22), inset 0 0 0 1px rgba(255, 255, 255, .6);
	transition: transform .65s cubic-bezier(.2, .9, .25, 1.05), opacity .35s ease, box-shadow .4s ease .3s;
	will-change: transform, opacity;
}
.ppm-assemble__piece[style*="opacity: 1"] { box-shadow: 0 0 0 rgba(0, 0, 0, 0), inset 0 0 0 1px rgba(255, 255, 255, .35); }
@media (prefers-reduced-motion: reduce) { .ppm-assemble { display: none; } }
.ppm-frame__safe { position: absolute; border: 2px dashed rgba(255, 255, 255, .9); box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); pointer-events: none; }

.ppm-adjust { margin-top: 10px; text-align: center; }
.ppm-adjust__hint { color: var(--ppm-muted); font-size: .85rem; margin: 10px auto 0; max-width: 34em; }
.ppm-adjust__zoom { display: inline-flex; align-items: center; gap: 10px; }
.ppm-adjust__zoom input[type=range] { width: 180px; accent-color: var(--ppm-accent); }
.ppm-adjust__btn { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--ppm-line); background: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--ppm-ink); }
.ppm-adjust__btn:hover { border-color: var(--ppm-accent); }
.ppm-tools { display: flex; justify-content: center; align-items: center; gap: 4px; margin-top: 12px; flex-wrap: wrap; }
.ppm-tool { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--ppm-ink); cursor: pointer; transition: background .15s; }
.ppm-tool svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ppm-tool:hover:not(:disabled) { background: var(--ppm-soft); }
.ppm-tool.is-active { background: var(--ppm-accent-soft); color: var(--ppm-accent-dark); }
.ppm-tool:disabled { color: #c9c4bd; cursor: default; }
.ppm-tool:focus-visible { outline: 2px solid var(--ppm-ink); outline-offset: 1px; }
.ppm-tools__sep { width: 1px; height: 22px; background: var(--ppm-line); margin: 0 6px; }
.ppm-adjust__reset { background: none; border: 0; color: var(--ppm-accent-dark); font-weight: 600; cursor: pointer; font-size: .88rem; }

.ppm-resolution { color: var(--ppm-muted); font-size: .85rem; margin: 10px 0 0; }
.ppm-lowres { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; padding: 10px 12px; background: #fde4e1; border-radius: 10px; font-size: .88rem; color: #7a1f12; cursor: pointer; }
.ppm-lowres input { margin-top: 3px; accent-color: var(--ppm-accent-dark); }
.ppm-frame__jigsaw { position: absolute; inset: 0; pointer-events: none; }
.ppm-frame__jigsaw svg { width: 100%; height: 100%; display: block; }
.ppm-frame__caption { text-align: center; color: var(--ppm-muted); font-weight: 500; margin-top: 16px; }

/* Show / hide the puzzle-piece lines over the preview */
.ppm-frame.hide-pieces .ppm-frame__jigsaw { visibility: hidden; }
.ppm-pieces { display: flex; align-items: center; gap: 8px; width: fit-content; margin: 8px auto 14px; font-size: .88rem; font-weight: 500; color: var(--ppm-ink); cursor: pointer; user-select: none; }
.ppm-pieces[hidden] { display: none; }
.ppm-pieces input { position: absolute; opacity: 0; pointer-events: none; }
.ppm-pieces__switch { position: relative; width: 36px; height: 20px; border-radius: 999px; background: #cfcbd4; transition: background .2s; flex: none; }
.ppm-pieces__switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.ppm-pieces input:checked + .ppm-pieces__switch { background: var(--ppm-accent); }
.ppm-pieces input:checked + .ppm-pieces__switch::after { transform: translateX(16px); }
.ppm-pieces input:focus-visible + .ppm-pieces__switch { outline: 2px solid var(--ppm-ink); outline-offset: 2px; }

.ppm-dropzone {
	position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
	background: var(--ppm-soft); border: 2px dashed #f1b9a8; border-radius: 2px; cursor: pointer; text-align: center; padding: 20px;
	color: var(--ppm-muted); transition: background .2s;
}
.ppm-dropzone:hover { background: var(--ppm-accent-soft); }
.ppm-dropzone strong { color: var(--ppm-ink); font-size: 1.15rem; }
.ppm-dropzone small { font-size: .82rem; opacity: .8; margin-top: 6px; }
.ppm-dropzone__icon { width: 68px; height: 68px; border-radius: 50%; background: #fff; display: grid; place-items: center; color: var(--ppm-accent); margin-bottom: 10px; box-shadow: 0 6px 16px rgba(0,0,0,.06); }
.ppm-dropzone[hidden] { display: none; }

.ppm-frame__progress { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); background: rgba(255,255,255,.95); padding: 10px 16px; border-radius: 12px; width: min(280px, 80%); text-align: center; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.ppm-frame__progress[hidden] { display: none; }
.ppm-frame__bar { height: 6px; background: var(--ppm-line); border-radius: 999px; overflow: hidden; margin-bottom: 6px; }
.ppm-frame__bar span { display: block; height: 100%; width: 0; background: var(--ppm-accent); transition: width .2s; }

/* Panel */
.ppm-creator__title { font-size: clamp(2rem, 4vw, 2.6rem); margin-bottom: .2em; }
.ppm-creator__intro { color: var(--ppm-muted); margin-bottom: 24px; }

.ppm-step { border: 0; padding: 0; margin: 0 0 28px; min-width: 0; }
.ppm-step legend { font-weight: 700; font-size: 1.05rem; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; padding: 0; }
.ppm-step__num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--c-navy, #22284a); color: #fff; font-size: .85rem; }

.ppm-photo-status { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ppm-btn-outline { display: inline-flex; align-items: center; padding: 10px 20px; border-radius: 999px; border: 1.5px solid var(--ppm-ink); font-weight: 600; cursor: pointer; transition: background .2s, color .2s; }
.ppm-btn-outline:hover { background: var(--ppm-ink); color: #fff; }
.ppm-quality { font-size: .88rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.ppm-quality[hidden] { display: none; }
.ppm-quality::before { margin-right: 6px; }
.ppm-quality--great, .ppm-quality--good { background: #e3f6ed; color: #136b47; }
.ppm-quality--great::before, .ppm-quality--good::before { content: "✓"; }
.ppm-quality--low { background: #fdf3dc; color: #8a5a0b; }
.ppm-quality--low::before, .ppm-quality--bad::before { content: "!"; }
.ppm-quality--bad { background: #fde4e1; color: #a12a1a; }
.ppm-error { color: #a12a1a; background: #fde4e1; padding: 10px 14px; border-radius: 10px; margin: 12px 0 0; font-size: .92rem; }
.ppm-error[hidden] { display: none; }
.ppm-hint { color: var(--ppm-muted); font-size: .88rem; margin: 10px 0 0; }
.ppm-hint[hidden] { display: none; }

/* Radio cards */
.ppm-style input, .ppm-size input { position: absolute; opacity: 0; pointer-events: none; }

.ppm-styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ppm-style { cursor: pointer; text-align: center; }
.ppm-style__thumb { display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 2.5px solid transparent; box-shadow: 0 0 0 1px var(--ppm-line); transition: border-color .2s, transform .2s; }
.ppm-style__thumb img { width: 100%; height: 100%; object-fit: cover; }
.ppm-style__label { display: block; font-size: .85rem; font-weight: 500; margin-top: 6px; }
.ppm-style:hover .ppm-style__thumb { transform: translateY(-2px); }
.ppm-style input:checked + .ppm-style__thumb { border-color: var(--ppm-accent); box-shadow: 0 0 0 3px var(--ppm-accent-soft); }
.ppm-style input:focus-visible + .ppm-style__thumb { outline: 2px solid var(--ppm-ink); outline-offset: 2px; }

/* AI art styles */
/* Style step: "Original" + AI styles, all the same square size. */
.ppm-ai { margin: 0; }
.ppm-step legend .ppm-ai__badge { margin-left: 4px; vertical-align: 2px; }
.ppm-style--orig .ppm-style__thumb { background: var(--ppm-soft); }
.ppm-style--orig .ppm-style__thumb img[hidden] { display: none; }
.ppm-ai__badge { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #fff; background: var(--ppm-accent); padding: 2px 8px; border-radius: 999px; }
.ppm-ai__hint { color: var(--ppm-muted); font-size: .82rem; margin: -4px 0 10px; }
.ppm-ai__note { color: var(--ppm-muted); font-size: .75rem; margin: 8px 0 0; }
.ppm-ai__error { margin: 10px 0 0; }
/* Same 4-column grid and square size as the classic styles; one row until expanded. */
/* Collapsed: the first 3 presets + "Make your own" (last in the DOM, so always the rightmost). */
.ppm-styles--ai.is-collapsed .ppm-style--ai:nth-child(n+4):not(.ppm-style--custom) { display: none; }
.ppm-styles--ai .ppm-style__label { font-size: .78rem; }
.ppm-ai__more { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; margin-top: 8px; padding: 6px; border: 0; background: none; color: var(--ppm-accent-dark); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; border-radius: 8px; }
.ppm-ai__more:hover { background: rgba(255,255,255,.6); }
.ppm-ai__more svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.ppm-ai__more[aria-expanded="true"] svg { transform: rotate(180deg); }
.ppm-style--ai .ppm-style__thumb { position: relative; display: grid; place-items: center; }
/* Placeholder art until the customer's own version exists. */
.ppm-style--ai .ppm-style__thumb::before { content: ""; position: absolute; inset: 0; background: var(--ppm-ai-bg, #eee); }
.ppm-style--ai .ppm-style__thumb::after { content: ""; position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; opacity: .85;
	background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9z'/%3E%3Cpath d='M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8z'/%3E%3C/svg%3E"); }
.ppm-style--ai.is-ready .ppm-style__thumb::after, .ppm-style--ai.is-loading .ppm-style__thumb::after { display: none; }
.ppm-style--ai .ppm-style__thumb img { position: relative; z-index: 1; }
.ppm-style--ai .ppm-style__thumb img[hidden] { display: none; }
.ppm-style--ai[data-ai="hollywood"] { --ppm-ai-bg: linear-gradient(135deg, #f9c74f, #b5179e); }
.ppm-style--ai[data-ai="astronaut"] { --ppm-ai-bg: linear-gradient(135deg, #0b1d51, #5e60ce); }
.ppm-style--ai[data-ai="christmas"] { --ppm-ai-bg: linear-gradient(135deg, #2d6a4f, #d62828); }
.ppm-style--ai[data-ai="royal"] { --ppm-ai-bg: linear-gradient(135deg, #6a040f, #e9c46a); }
.ppm-style--ai[data-ai="cartoon"] { --ppm-ai-bg: linear-gradient(135deg, #ffb36b, #ff6b8b); }
.ppm-style--ai[data-ai="watercolor"] { --ppm-ai-bg: linear-gradient(135deg, #8fd3f4, #c9a7f5); }
.ppm-style--ai[data-ai="oil"] { --ppm-ai-bg: linear-gradient(135deg, #a8743c, #3e5c3a); }
.ppm-style--ai[data-ai="comic"] { --ppm-ai-bg: linear-gradient(135deg, #ffd23f, #ee4266); }
.ppm-style--ai[data-ai="hero"] { --ppm-ai-bg: linear-gradient(135deg, #4361ee, #f72585); }
/* "Make your own" card: dashed, invites a click. */
.ppm-style--custom { --ppm-ai-bg: var(--ppm-soft); }
.ppm-style--custom .ppm-style__thumb { box-shadow: none; border: 2.5px dashed #e9b8a6; }
.ppm-style--custom .ppm-style__thumb::after { width: 30px; height: 30px; opacity: 1;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23e8502f'%3E%3Cpath d='M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9z'/%3E%3Cpath d='M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8z'/%3E%3C/svg%3E"); }
.ppm-style--custom.is-ready .ppm-style__thumb { border-style: solid; border-color: transparent; box-shadow: 0 0 0 1px var(--ppm-line); }
.ppm-style--custom input:checked + .ppm-style__thumb { border: 2.5px solid var(--ppm-accent); }
.ppm-style--custom .ppm-style__label { color: var(--ppm-accent-dark); font-weight: 600; }
.ppm-style--custom.is-ready .ppm-style__label { color: inherit; font-weight: 500; }
.ppm-style--ai .ppm-style__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Idea dialog */
.ppm-idea { border: 0; padding: 0; border-radius: 20px; width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 24px 60px rgba(31, 37, 55, .25); color: var(--ppm-ink); background: var(--ppm-surface); }
.ppm-idea::backdrop { background: rgba(31, 37, 55, .45); }
.ppm-idea__box { position: relative; padding: 26px 24px 22px; }
.ppm-idea__close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; cursor: pointer; color: var(--ppm-ink); }
.ppm-idea__close:hover { background: var(--ppm-soft); }
.ppm-idea__close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ppm-idea__title { font-size: 1.35rem; margin: 0 40px 6px 0; }
.ppm-idea__intro { color: var(--ppm-muted); margin: 0 0 16px; font-size: .95rem; }
.ppm-idea__field { position: relative; }
.ppm-idea__field textarea { width: 100%; box-sizing: border-box; resize: none; font: inherit; padding: 12px 14px 26px; border: 1.5px solid var(--ppm-line); border-radius: 12px; background: #fff; color: var(--ppm-ink); }
.ppm-idea__field textarea:focus { outline: none; border-color: var(--ppm-accent); box-shadow: 0 0 0 3px var(--ppm-accent-soft); }
.ppm-idea__count { position: absolute; right: 12px; bottom: 8px; font-size: .75rem; color: var(--ppm-muted); }
.ppm-idea__or { display: flex; align-items: center; gap: 12px; color: var(--ppm-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 10px; }
.ppm-idea__or::before, .ppm-idea__or::after { content: ""; flex: 1; height: 1px; background: var(--ppm-line); }
.ppm-idea__label { margin: 0 0 8px; font-size: .9rem; font-weight: 500; }
.ppm-idea__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.ppm-idea__chip { border: 1.5px solid var(--ppm-line); background: var(--ppm-soft); color: var(--ppm-ink); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: .88rem; cursor: pointer; transition: border-color .15s, background .15s; }
.ppm-idea__chip:hover { border-color: var(--ppm-accent); background: var(--ppm-accent-soft); }
.ppm-idea__submit { width: 100%; }
.ppm-idea__submit:disabled { opacity: .45; cursor: not-allowed; }
.ppm-idea__hint { text-align: center; color: var(--ppm-muted); font-size: .8rem; margin: 10px 0 0; }

.ppm-style.is-disabled { cursor: not-allowed; opacity: .55; }
.ppm-style.is-disabled:hover .ppm-style__thumb { transform: none; }
.ppm-style--ai.is-error .ppm-style__thumb { box-shadow: 0 0 0 1px #e0a39a; }
.ppm-style__spin { position: relative; z-index: 2; width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255,255,255,.45); border-top-color: #fff; animation: ppm-spin .8s linear infinite; }
.ppm-style__spin[hidden] { display: none; }

/* "Creating your art…" over the preview */
.ppm-frame__busy { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.95); padding: 10px 16px; border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.12); white-space: nowrap; }
.ppm-frame__busy[hidden] { display: none; }
.ppm-frame__busy small { font-weight: 500; color: var(--ppm-ink); }
.ppm-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--ppm-accent-soft); border-top-color: var(--ppm-accent); animation: ppm-spin .8s linear infinite; }
.ppm-frame.is-ai-busy .ppm-frame__img { filter: saturate(.6) blur(1px); transition: filter .3s; }
@keyframes ppm-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ppm-style__spin, .ppm-spinner { animation-duration: 2.4s; } }

.ppm-sizes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ppm-size { cursor: pointer; }
.ppm-size__box { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 14px 16px; border: 1.5px solid var(--ppm-line); border-radius: 12px; background: var(--ppm-surface); transition: border-color .2s, box-shadow .2s; }
.ppm-size__pieces { font-weight: 700; font-size: 1.1rem; }
.ppm-size__pieces small { font-weight: 500; color: var(--ppm-muted); font-size: .85rem; }
.ppm-size__dims { grid-column: 1; color: var(--ppm-muted); font-size: .88rem; }
.ppm-size__price { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 700; color: var(--ppm-accent-dark); }
.ppm-size__note { position: absolute; top: -10px; right: 12px; background: var(--c-navy, #22284a); color: #fff; font-size: .7rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.ppm-size:hover .ppm-size__box { border-color: #f1b9a8; }
.ppm-size input:checked + .ppm-size__box { border-color: var(--ppm-accent); box-shadow: 0 0 0 3px var(--ppm-accent-soft); }
.ppm-size input:focus-visible + .ppm-size__box { outline: 2px solid var(--ppm-ink); outline-offset: 2px; }


/* Summary */
.ppm-summary { background: var(--ppm-surface); border-radius: var(--ppm-radius); padding: 22px; box-shadow: 0 10px 30px rgba(31, 37, 55, .08); }
.ppm-summary__row { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.05rem; }
.ppm-summary__price { font-size: 1.7rem; font-family: var(--font-display, Georgia, serif); }
.ppm-summary__perks { list-style: none; margin: 10px 0 18px; padding: 0; color: var(--ppm-muted); font-size: .9rem; }
.ppm-summary__perks li::before { content: "✓"; color: var(--c-success, #1f9d6b); font-weight: 700; margin-right: 8px; }
.ppm-submit { width: 100%; }
.ppm-submit-hint { text-align: center; }


/* Cart / order thumbnails */
.ppm-cart-thumb { border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.ppm-order-thumb { display: block; width: 120px; border-radius: 4px; margin: 8px 0; }
