/* Dress Up Pals - game styles. Override any --dup-* variable in your theme. */
.dup-game {
	--dup-ink: #2b2550;
	--dup-bg: #fff7fb;
	--dup-panel: #ffffff;
	--dup-pink: #ff5fa2;
	--dup-blue: #2f8cff;
	--dup-yellow: #ffc83d;
	--dup-green: #39c07f;
	--dup-purple: #8b5cf6;
	--dup-line: #f0dbe8;
	--dup-radius: 22px;
	font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", sans-serif;
	color: var(--dup-ink);
	background: var(--dup-bg);
	border-radius: calc(var(--dup-radius) + 6px);
	padding: clamp(10px, 2.5vw, 22px);
	position: relative;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
	-webkit-user-select: none;
	box-sizing: border-box;
	container-type: inline-size;
}
.dup-game *, .dup-game *::before, .dup-game *::after { box-sizing: border-box; }
.dup-game img { max-width: none; }

.dup-wrap {
	display: grid;
	grid-template-columns: minmax(230px, 0.85fr) 1.15fr;
	gap: clamp(12px, 2.5vw, 26px);
	align-items: start;
}
.dup-left, .dup-right { min-width: 0; }
@container (min-width: 1000px) { .dup-wrap { grid-template-columns: 420px 1fr; } }


/* doll picker */
.dup-dolls { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-bottom: 10px; padding: 4px 2px; }
.dup-doll-btn {
	flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; padding: 0; overflow: hidden; cursor: pointer;
	border: 3px solid transparent; background: #fff; box-shadow: 0 2px 0 var(--dup-line);
	transition: transform .15s, border-color .15s;
}
.dup-doll-btn img { width: 100%; height: 190%; object-fit: cover; object-position: 50% 0; display: block; }
.dup-doll-btn:hover { transform: translateY(-2px); }
.dup-doll-btn.is-on { border-color: var(--dup-pink); transform: scale(1.06); }

/* stage */
.dup-stage {
	position: relative; width: 100%; overflow: hidden; cursor: pointer;
	background: radial-gradient(circle at 50% 38%, #fff 0 45%, #ffe9f4 100%);
	border-radius: var(--dup-radius);
	box-shadow: inset 0 0 0 3px var(--dup-line);
	transition: box-shadow .15s, transform .15s;
}
.dup-stage.is-target { box-shadow: inset 0 0 0 5px var(--dup-pink); transform: scale(1.01); }
.dup-doll, .dup-layer { position: absolute; display: block; pointer-events: none; }
.dup-doll { inset: 0; width: 100%; height: 100%; object-fit: contain; }
.dup-canvas { position: absolute; left: 0; width: 100%; }
.dup-layers { position: absolute; inset: 0; }
.dup-layer { height: auto; }
.dup-layer.is-pop { animation: dup-pop .35s cubic-bezier(.3, 1.6, .5, 1); transform-origin: 50% 30%; }
@keyframes dup-pop { 0% { transform: scale(.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* actions */
.dup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.dup-btn {
	font: inherit; font-weight: 800; font-size: 15px; line-height: 1.1; color: #fff;
	border: 0; border-radius: 999px; padding: 12px 14px; cursor: pointer; text-align: center; text-decoration: none;
	box-shadow: 0 4px 0 rgba(0, 0, 0, .18); transition: transform .1s, box-shadow .1s, filter .15s;
	display: inline-flex; align-items: center; justify-content: center; min-height: 46px;
}
.dup-btn:hover { filter: brightness(1.06); }
.dup-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.dup-btn:focus-visible, .dup-item:focus-visible, .dup-tab:focus-visible, .dup-doll-btn:focus-visible, .dup-chip:focus-visible { outline: 3px solid var(--dup-blue); outline-offset: 2px; }
.dup-btn-reset { background: #a49cc4; }
.dup-btn-random { background: var(--dup-purple); }
.dup-btn-save { background: var(--dup-green); }
.dup-btn-print { background: var(--dup-blue); }

/* packs + tabs */
.dup-packs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; margin-bottom: 4px; scrollbar-width: thin; }
.dup-chip { flex: 0 0 auto; white-space: nowrap; }
.dup-chip {
	font: inherit; font-weight: 700; font-size: 14px; border: 2px solid var(--dup-line); background: #fff; color: var(--dup-ink);
	border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.dup-chip.is-on { background: var(--dup-yellow); border-color: var(--dup-yellow); }

.dup-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.dup-tab {
	font: inherit; flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px;
	min-width: 68px; padding: 8px 8px 6px; border-radius: 16px; cursor: pointer;
	border: 2px solid var(--dup-line); background: #fff; color: var(--dup-ink);
}
.dup-tab-icon { font-size: 24px; line-height: 1; }
.dup-tab-label { font-size: 12px; font-weight: 800; white-space: nowrap; }
.dup-tab.is-on { background: var(--dup-pink); border-color: var(--dup-pink); color: #fff; }

/* wardrobe */
.dup-grid {
	display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px;
	background: var(--dup-panel); border-radius: var(--dup-radius); padding: 12px;
	box-shadow: inset 0 0 0 3px var(--dup-line);
	max-height: 560px; overflow-y: auto; touch-action: pan-y;
}
.dup-item {
	position: relative; aspect-ratio: 1; padding: 8px; border-radius: 16px; cursor: grab;
	background: #fbf6ff; border: 3px solid transparent; touch-action: pan-y;
	transition: transform .12s, border-color .12s, background .12s;
}
.dup-item img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.dup-item:hover { transform: translateY(-2px) rotate(-1deg); background: #fff0f7; }
.dup-item.is-worn { border-color: var(--dup-green); background: #ecfbf3; }
.dup-item.is-worn::after {
	content: "✓"; position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%;
	background: var(--dup-green); color: #fff; font-weight: 900; font-size: 14px; line-height: 24px; text-align: center;
}
.dup-item.is-locked img { opacity: .55; filter: saturate(.6); }
.dup-lock {
	position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
	background: var(--dup-yellow); color: var(--dup-ink); font-size: 11px; font-weight: 900;
	padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.dup-empty { grid-column: 1 / -1; text-align: center; opacity: .7; margin: 20px 0; }
.dup-hint { font-size: 13px; opacity: .75; margin: 10px 4px 0; }

.dup-ghost {
	position: fixed; left: 0; top: 0; width: 90px; height: 90px; object-fit: contain; z-index: 99999;
	pointer-events: none; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .25)); transform-origin: center;
}
.dup-game.is-dragging, .dup-game.is-dragging * { cursor: grabbing !important; }

/* pro modal */
.dup-modal {
	position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
	background: rgba(43, 37, 80, .45); border-radius: inherit; padding: 16px;
}
.dup-modal-card {
	background: #fff; border-radius: var(--dup-radius); padding: 22px; max-width: 340px; width: 100%;
	text-align: center; box-shadow: 0 20px 40px rgba(0, 0, 0, .2); display: grid; gap: 10px;
	animation: dup-pop .3s cubic-bezier(.3, 1.6, .5, 1);
}
.dup-modal-card > * { min-width: 0; max-width: 100%; }
.dup-modal-card h3 { margin: 0 !important; font-size: 22px; line-height: 1.2; color: var(--dup-ink); }
.dup-modal-card p { margin: 0 !important; padding: 0; font-size: 16px; line-height: 1.4; }
.dup-modal-img { width: 110px; height: 110px; object-fit: contain; margin: 0 auto; }
.dup-btn-pro { background: var(--dup-pink); }
.dup-btn-close { background: #a49cc4; }

@media (prefers-reduced-motion: reduce) {
	.dup-game * { animation: none !important; transition: none !important; }
}

/* ---------- phones: pal pinned on top with icon buttons beside it, wardrobe fills the rest */
@container (max-width: 600px) {
	.dup-game .dup-wrap { grid-template-columns: 1fr; gap: 8px; }
	.dup-game .dup-left {
		position: sticky; top: 0; z-index: 3; background: var(--dup-bg); padding: 4px 0 8px;
		display: grid; grid-template-columns: minmax(0, 1fr) 50px; grid-template-areas: "dolls dolls" "stage actions";
		gap: 6px 8px; align-items: center;
		box-shadow: 0 8px 10px -8px rgba(43, 37, 80, .18);
	}
	.dup-game .dup-dolls {
		grid-area: dolls; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; margin: 0;
		padding: 3px 2px 5px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
	}
	.dup-game .dup-dolls::-webkit-scrollbar { display: none; }
	.dup-game .dup-doll-btn { width: 40px; height: 40px; border-width: 2px; }
	.dup-game .dup-stage { grid-area: stage; height: 42vh; height: 42svh; width: auto; max-width: 100%; justify-self: center; }
	.dup-game .dup-actions { grid-area: actions; grid-template-columns: 1fr; margin: 0; gap: 10px; align-content: center; }
	.dup-game .dup-actions .dup-btn {
		width: 48px; height: 48px; min-height: 48px; padding: 0; border-radius: 50%;
		font-size: 0; line-height: 0; box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
	}
	.dup-game .dup-actions .dup-btn::before { font-size: 22px; line-height: 1; }
	.dup-game .dup-btn-reset::before { content: "↺"; color: #fff; font-weight: 900; }
	.dup-game .dup-btn-random::before { content: "🎲"; }
	.dup-game .dup-btn-save::before { content: "💾"; }
	.dup-game .dup-btn-print::before { content: "🖨️"; }

	.dup-game .dup-packs { margin-bottom: 2px; }
	.dup-game .dup-tabs { gap: 5px; padding-bottom: 6px; scrollbar-width: none; }
	.dup-game .dup-tabs::-webkit-scrollbar { display: none; }
	.dup-game .dup-tab { min-width: 54px; padding: 5px 6px 4px; border-radius: 12px; }
	.dup-game .dup-tab-icon { font-size: 19px; }
	.dup-game .dup-tab-label { font-size: 10px; }
	.dup-game .dup-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 6px;
		max-height: none; overflow: visible; border-radius: 16px;
	}
	.dup-game .dup-item { padding: 4px; border-radius: 12px; border-width: 2px; }
	.dup-game .dup-item:hover { transform: none; }
	.dup-game .dup-item.is-worn::after { top: -5px; right: -5px; width: 18px; height: 18px; line-height: 18px; font-size: 11px; }
	.dup-game .dup-hint { display: none; }
}
@container (max-width: 360px) {
	.dup-game .dup-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* on phones, let the game use the full screen width even inside a narrow theme column */
@media (max-width: 600px) {
	.dup-game { width: 100vw; max-width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); border-radius: 0; padding: 6px 8px 12px; }
}
