/*!
 * AI Prompt Hub — front-end styles.
 * Colors come from CSS variables printed from Settings → Colors (see :root inline style).
 * Mobile-first. Animations respect prefers-reduced-motion and the admin toggles.
 */

/* ---------- Tokens ---------- */
:root {
	--ph-bg: #0e1024;
	--ph-card: #171a33;
	--ph-border: #2a2e55;
	--ph-text: #f5f3ff;
	--ph-muted: #a5a8c8;
	--ph-accent-1: #ff8a3d;
	--ph-accent-2: #ff5e73;
	--ph-rose: #f4b6a6;
	--ph-success: #3ddc97;
	--ph-radius: 18px;
	--ph-gap: 16px;
	--ph-font-head: 'Poppins', system-ui, sans-serif;
	--ph-font-body: 'Inter', system-ui, sans-serif;
	--ph-grad: linear-gradient(110deg, var(--ph-accent-1), var(--ph-accent-2), var(--ph-accent-1));
	--ph-glow: 0 18px 44px -18px color-mix(in srgb, var(--ph-accent-1) 70%, transparent);
	--ph-ease: cubic-bezier(.2, .8, .2, 1);
}

.ph-scope,
.ph-modal,
.ph-toast {
	--ph-cols: var(--ph-cols-m, 2);
	color: var(--ph-text);
	font-family: var(--ph-font-body);
	font-size: 15px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}
@media (min-width: 768px) {
	.ph-scope { --ph-cols: var(--ph-cols-d, 3); }
}
.ph-scope *,
.ph-modal * { box-sizing: border-box; }
.ph-scope img { max-width: 100%; height: auto; display: block; }
.ph-scope a { color: inherit; text-decoration: none; }
.ph-scope h1, .ph-scope h2, .ph-scope h3, .ph-modal h3 {
	font-family: var(--ph-font-head);
	color: var(--ph-text);
	line-height: 1.25;
	margin: 0 0 .5em;
	letter-spacing: -.01em;
}
.ph-icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.15em; }
.ph-muted { color: var(--ph-muted); }
.ph-sr, .ph-scope .screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.ph-container { max-width: 1240px; margin: 0 auto; padding: 24px 16px 48px; }
.ph-notice {
	background: color-mix(in srgb, var(--ph-card) 85%, var(--ph-accent-1));
	border: 1px solid var(--ph-border);
	border-radius: calc(var(--ph-radius) * .66);
	padding: 12px 16px;
	color: var(--ph-text);
	margin: 0 0 16px;
}
.ph-notice.is-error { border-color: var(--ph-accent-2); }
.ph-notice.is-success { border-color: var(--ph-success); }
.ph-link { background: none; border: 0; padding: 0; color: var(--ph-rose); cursor: pointer; font: inherit; text-decoration: underline; }

/* ---------- Buttons ---------- */
.ph-btn {
	--ph-btn-pad: 11px 18px;
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: var(--ph-btn-pad);
	border-radius: 999px;
	border: 1px solid var(--ph-border);
	background: var(--ph-card);
	color: var(--ph-text);
	font: 600 14px/1.2 var(--ph-font-head);
	cursor: pointer;
	text-decoration: none;
	transition: transform .2s var(--ph-ease), box-shadow .25s var(--ph-ease), background-color .2s, border-color .2s, opacity .2s;
	-webkit-tap-highlight-color: transparent;
	position: relative;
	white-space: nowrap;
}
.ph-btn:hover { border-color: var(--ph-accent-1); }
.ph-btn:active { transform: scale(.97); }
.ph-btn:focus-visible, .ph-tab:focus-visible, .ph-chip:focus-visible, .ph-like:focus-visible { outline: 2px solid var(--ph-rose); outline-offset: 2px; }
.ph-btn[disabled] { opacity: .5; cursor: not-allowed; }
.ph-btn--sm { --ph-btn-pad: 7px 12px; font-size: 12.5px; }
.ph-btn--lg { --ph-btn-pad: 15px 26px; font-size: 16px; }
.ph-btn--block { width: 100%; }
.ph-btn--ghost { background: transparent; }
.ph-btn--grad {
	border: 0;
	color: #fff;
	background-image: var(--ph-grad);
	background-size: 220% 100%;
	background-position: 0% 50%;
	box-shadow: var(--ph-glow);
}
.ph-btn--grad:hover { background-position: 100% 50%; transform: translateY(-1px); }
body:not(.ph-no-anim):not(.ph-no-gradient) .ph-btn--grad { animation: ph-grad-shift 6s ease-in-out infinite; transition: transform .2s var(--ph-ease), box-shadow .25s; }
@keyframes ph-grad-shift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.ph-btn.is-copied { background: var(--ph-success); background-image: none; color: #062a1b; }
.ph-btn.is-loading { pointer-events: none; opacity: .75; }
.ph-btn.is-loading::after {
	content: ""; width: 14px; height: 14px; border-radius: 50%;
	border: 2px solid currentColor; border-right-color: transparent;
	animation: ph-spin .7s linear infinite;
}
@keyframes ph-spin { to { transform: rotate(360deg); } }
.ph-btn__price { opacity: .95; font-weight: 700; }
.ph-icon-btn {
	width: 38px; height: 38px; border-radius: 50%;
	display: inline-grid; place-items: center;
	background: var(--ph-card); color: var(--ph-text);
	border: 1px solid var(--ph-border); cursor: pointer;
	transition: border-color .2s, transform .2s;
}
.ph-icon-btn:hover { border-color: var(--ph-accent-1); transform: scale(1.05); }

/* ---------- Badges, chips, tools ---------- */
.ph-badge {
	display: inline-flex; align-items: center; gap: 4px;
	padding: 4px 9px; border-radius: 999px;
	font: 700 11.5px/1 var(--ph-font-head);
	background: rgba(14, 16, 36, .72);
	color: var(--ph-text);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	border: 1px solid rgba(255, 255, 255, .08);
}
.ph-badge .ph-icon { width: 13px; height: 13px; }
.ph-badge--premium { color: var(--ph-rose); }
.ph-badge--free { color: var(--ph-success); }
.ph-badge--flame { color: var(--ph-accent-1); }
.ph-badge--tpl { color: #b7a6ff; }
.ph-flame { display: inline-flex; color: var(--ph-accent-1); }
.ph-flame .ph-icon { width: 1em; height: 1em; }
body:not(.ph-no-anim):not(.ph-no-flame) .ph-badge--flame .ph-icon,
body:not(.ph-no-anim):not(.ph-no-flame) .ph-flame .ph-icon { animation: ph-flicker 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes ph-flicker {
	0%, 100% { transform: scale(1) rotate(0); filter: drop-shadow(0 0 0 transparent); }
	30% { transform: scale(1.12, 1.18) rotate(-4deg); filter: drop-shadow(0 0 4px var(--ph-accent-1)); }
	60% { transform: scale(.95, 1.05) rotate(3deg); }
}

.ph-tools { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.ph-tool {
	font: 600 11px/1 var(--ph-font-body);
	padding: 5px 8px; border-radius: 6px;
	background: color-mix(in srgb, var(--ph-border) 70%, transparent);
	color: var(--ph-muted);
}
.ph-tools--overlay { position: absolute; left: 12px; bottom: 12px; }
.ph-tools--overlay .ph-tool { background: rgba(14, 16, 36, .75); color: var(--ph-text); backdrop-filter: blur(6px); }

.ph-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.ph-chips--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.ph-chips--scroll::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .ph-chips--scroll { flex-wrap: wrap; overflow: visible; } }
.ph-chip {
	flex: none;
	display: inline-flex; align-items: center; gap: 6px;
	padding: 8px 14px; border-radius: 999px;
	border: 1px solid var(--ph-border);
	background: var(--ph-card);
	color: var(--ph-muted);
	font: 600 13px/1 var(--ph-font-head);
	transition: color .2s, border-color .2s, background .2s, transform .2s;
	cursor: pointer;
}
.ph-chip:hover { color: var(--ph-text); border-color: var(--ph-accent-1); }
.ph-chip.is-active { color: #fff; border-color: transparent; background: var(--ph-grad); background-size: 200% 100%; }
.ph-chip--sm { padding: 5px 10px; font-size: 12px; }
.ph-chip__count { opacity: .7; font-weight: 500; }

/* ---------- Cards ---------- */
.ph-card {
	position: relative;
	display: flex; flex-direction: column;
	background: var(--ph-card);
	border: 1px solid var(--ph-border);
	border-radius: var(--ph-radius);
	overflow: hidden;
	transition: transform .3s var(--ph-ease), box-shadow .3s var(--ph-ease), border-color .3s;
	min-width: 0;
}
body:not(.ph-no-anim):not(.ph-no-lift) .ph-card:hover {
	transform: translateY(var(--ph-lift, -6px));
	border-color: color-mix(in srgb, var(--ph-accent-1) 60%, var(--ph-border));
	box-shadow: var(--ph-glow), 0 0 0 1px color-mix(in srgb, var(--ph-accent-1) 25%, transparent);
}
.ph-card__media { position: relative; display: block; background: var(--ph-bg); overflow: hidden; }
.ph-card__img { width: 100%; height: auto; transition: transform .6s var(--ph-ease); }
.ph-card:hover .ph-card__img { transform: scale(1.04); }
.ph-card__img--empty { display: block; aspect-ratio: 4 / 5; background: linear-gradient(135deg, var(--ph-card), var(--ph-border)); }
.ph-card__badges { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-between; pointer-events: none; }
.ph-card__badges .ph-badge--premium, .ph-card__badges .ph-badge--free { margin-left: auto; }
.ph-card__body { padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.ph-card__title { font-size: 14.5px; margin: 0; line-height: 1.3; }
.ph-card__title a:hover { color: var(--ph-rose); }
.ph-card__foot { display: flex; align-items: center; gap: 10px; margin-top: auto; flex-wrap: wrap; }
.ph-card__foot .ph-btn { margin-left: auto; }
.ph-stat { display: inline-flex; align-items: center; gap: 4px; color: var(--ph-muted); font-size: 12.5px; }
.ph-like {
	display: inline-flex; align-items: center; gap: 4px;
	background: none; border: 0; padding: 2px; cursor: pointer;
	color: var(--ph-muted); font: inherit; font-size: 12.5px;
	transition: color .2s, transform .2s;
}
.ph-like:hover { color: var(--ph-accent-2); }
.ph-like.is-liked { color: var(--ph-accent-2); }
.ph-like.is-liked path { fill: currentColor; }
.ph-like.is-pop { animation: ph-pop .45s var(--ph-ease); }
.ph-like--lg { font-size: 14px; padding: 8px 12px; border: 1px solid var(--ph-border); border-radius: 999px; }
@keyframes ph-pop { 40% { transform: scale(1.3); } }

@media (max-width: 480px) {
	.ph-card__body { padding: 10px; gap: 8px; }
	.ph-card__title { font-size: 13.5px; }
	.ph-card__foot .ph-btn { width: 100%; margin-left: 0; }
}

/* ---------- Grid / masonry ---------- */
.ph-grid-wrap { margin: 0 0 32px; }
.ph-grid-bar { display: flex; flex-direction: column; gap: 12px; margin: 0 0 18px; }
@media (min-width: 900px) { .ph-grid-bar { flex-direction: row; align-items: center; justify-content: space-between; } }
.ph-search {
	display: flex; align-items: center; gap: 10px;
	background: var(--ph-card);
	border: 1px solid var(--ph-border);
	border-radius: 999px;
	padding: 0 16px;
	min-width: 0; flex: 1; max-width: 520px;
	color: var(--ph-muted);
	transition: border-color .2s, box-shadow .2s;
}
.ph-search:focus-within { border-color: var(--ph-accent-1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ph-accent-1) 25%, transparent); }
.ph-search input {
	flex: 1; min-width: 0; height: 46px;
	background: transparent !important; border: 0 !important; outline: 0; box-shadow: none !important;
	color: var(--ph-text) !important; font: 15px var(--ph-font-body); padding: 0 !important;
}
.ph-search input::placeholder { color: var(--ph-muted); }
.ph-tabs {
	display: flex; gap: 6px; padding: 4px;
	background: var(--ph-card); border: 1px solid var(--ph-border); border-radius: 999px;
	overflow-x: auto; scrollbar-width: none; max-width: 100%;
}
.ph-tabs::-webkit-scrollbar { display: none; }
.ph-tab {
	flex: none; border: 0; cursor: pointer;
	padding: 9px 16px; border-radius: 999px;
	background: transparent; color: var(--ph-muted);
	font: 600 13.5px/1 var(--ph-font-head);
	transition: color .2s, background .25s;
}
.ph-tab:hover { color: var(--ph-text); }
.ph-tab.is-active { color: #fff; background: var(--ph-grad); background-size: 200% 100%; box-shadow: var(--ph-glow); }

.ph-grid { display: grid; grid-template-columns: repeat(var(--ph-cols, 2), minmax(0, 1fr)); gap: var(--ph-gap); align-items: start; }
.ph-grid--static { display: block; }
.ph-grid--static > .ph-grid__inner { display: grid; grid-template-columns: repeat(var(--ph-cols, 2), minmax(0, 1fr)); gap: var(--ph-gap); }
@media (max-width: 380px) { .ph-scope { --ph-gap: 10px; } }
.ph-masonry.is-masonry { grid-auto-rows: 4px; row-gap: 0; }
.ph-masonry.is-masonry > * { margin-bottom: var(--ph-gap); }
.ph-grid__ad, .ph-masonry .ph-ad { grid-column: 1 / -1; }
.ph-grid.is-loading { opacity: .55; transition: opacity .2s; }
.ph-empty { color: var(--ph-muted); text-align: center; padding: 24px 0; }
.ph-more { display: flex; justify-content: center; margin-top: 22px; }
.ph-ad { margin: 0 0 18px; text-align: center; overflow: hidden; }

/* Skeletons */
.ph-skel {
	display: block; border-radius: 10px;
	background: linear-gradient(90deg, var(--ph-card) 0%, color-mix(in srgb, var(--ph-border) 80%, var(--ph-card)) 40%, var(--ph-card) 80%);
	background-size: 300% 100%;
}
body:not(.ph-no-anim):not(.ph-no-shimmer) .ph-skel { animation: ph-shimmer 1.3s linear infinite; }
@keyframes ph-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.ph-skel--line { height: 12px; margin: 8px 0; }
.ph-skel--short { width: 60%; }
.ph-skel--thumb { width: 64px; height: 64px; border-radius: 12px; }
.ph-skel-card { border-radius: var(--ph-radius); overflow: hidden; border: 1px solid var(--ph-border); background: var(--ph-card); }
.ph-skel-card .ph-skel--img { aspect-ratio: 4 / 5; border-radius: 0; }
.ph-skel-card > div { padding: 12px; }

/* ---------- Sections, slider, lists ---------- */
.ph-section { margin: 0 0 36px; }
.ph-section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.ph-section__title { font-size: clamp(19px, 2.6vw, 26px); margin: 0; display: flex; align-items: center; gap: 8px; }
.ph-slider__nav { display: none; gap: 8px; }
@media (min-width: 768px) { .ph-slider__nav { display: flex; } }
.ph-slider { position: relative; }
.ph-slider__track {
	display: flex; gap: var(--ph-gap);
	overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
	padding: 6px 2px 14px; margin: -6px -2px 0;
	scrollbar-width: thin; scrollbar-color: var(--ph-border) transparent;
	-webkit-overflow-scrolling: touch;
	outline: none;
}
.ph-slider__track > * { flex: 0 0 var(--ph-slide-w, 62%); scroll-snap-align: start; }
@media (min-width: 600px) { .ph-slider__track > * { flex-basis: var(--ph-slide-w, 38%); } }
@media (min-width: 1024px) { .ph-slider__track > * { flex-basis: var(--ph-slide-w, 23%); } }
@media (prefers-reduced-motion: reduce) { .ph-slider__track { scroll-behavior: auto; } }
.ph-ranked { position: relative; padding-left: 26px; }
.ph-rank-num {
	position: absolute; left: -4px; bottom: 8px; z-index: 2;
	font: 800 64px/1 var(--ph-font-head);
	color: transparent;
	-webkit-text-stroke: 2px var(--ph-accent-1);
	text-shadow: 0 6px 24px color-mix(in srgb, var(--ph-accent-1) 40%, transparent);
	pointer-events: none;
}
.ph-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ph-list__item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--ph-card); border: 1px solid var(--ph-border); border-radius: var(--ph-radius); }
.ph-list__rank { font: 800 22px/1 var(--ph-font-head); color: var(--ph-accent-1); width: 28px; text-align: center; }
.ph-list__thumb img { width: 54px; height: 54px; object-fit: cover; border-radius: 12px; }
.ph-list__main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ph-list__title { font: 600 14.5px/1.3 var(--ph-font-head); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-list__meta { display: flex; align-items: center; gap: 4px; color: var(--ph-muted); font-size: 12px; }
.ph-switch > .ph-tabs { display: inline-flex; margin: 0 0 16px; }

/* ---------- Collections ---------- */
.ph-collections { display: grid; grid-template-columns: repeat(var(--ph-cols, 2), minmax(0, 1fr)); gap: var(--ph-gap); margin: 0 0 32px; }
.ph-collection {
	position: relative; display: flex; align-items: flex-end;
	min-height: 150px; border-radius: var(--ph-radius); overflow: hidden;
	background: linear-gradient(140deg, var(--ph-col-color, var(--ph-accent-2)), var(--ph-card) 85%);
	border: 1px solid var(--ph-border);
	isolation: isolate;
	transition: transform .3s var(--ph-ease), box-shadow .3s;
}
.ph-collection:hover { transform: translateY(-4px); box-shadow: var(--ph-glow); }
.ph-collection__img { position: absolute; inset: 0; width: 100%; height: 100% !important; object-fit: cover; z-index: -2; transition: transform .6s var(--ph-ease); }
.ph-collection:hover .ph-collection__img { transform: scale(1.06); }
.ph-collection__shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, transparent 30%, color-mix(in srgb, var(--ph-bg) 88%, transparent)); }
.ph-collection__body { padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.ph-collection__name { font: 700 17px/1.2 var(--ph-font-head); }
.ph-collection__count { color: var(--ph-muted); font-size: 12.5px; }

/* ---------- Prompt box ---------- */
.ph-box {
	display: grid; gap: 18px;
	background: var(--ph-card);
	border: 1px solid var(--ph-border);
	border-radius: calc(var(--ph-radius) + 4px);
	padding: 12px;
	margin: 0 0 28px;
}
@media (min-width: 900px) {
	.ph-box { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 18px; gap: 26px; align-items: start; }
	.ph-box-layout-stacked .ph-box { grid-template-columns: 1fr; }
	.ph-box__media { position: sticky; top: 24px; }
}
.ph-box__media { position: relative; border-radius: var(--ph-radius); overflow: hidden; background: var(--ph-bg); }
.ph-box__img { width: 100%; max-height: 82vh; object-fit: contain; margin: 0 auto; }
.ph-box__body { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 4px 4px 6px; }
.ph-box__title { font-size: clamp(22px, 3vw, 32px); margin: 0; }
.ph-box__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ph-box__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ph-prompt { background: var(--ph-bg); border: 1px solid var(--ph-border); border-radius: var(--ph-radius); overflow: hidden; }
.ph-prompt__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--ph-border); }
.ph-prompt__label { font: 700 12px/1 var(--ph-font-head); text-transform: uppercase; letter-spacing: .08em; color: var(--ph-rose); }
.ph-prompt__text {
	padding: 16px; white-space: pre-wrap; word-break: break-word;
	font: 14.5px/1.65 var(--ph-font-body); color: var(--ph-text);
	max-height: 420px; overflow: auto;
	user-select: text;
}

/* ---------- Lock card ---------- */
.ph-lock {
	position: relative; text-align: center;
	padding: 26px 18px 20px;
	border-radius: var(--ph-radius);
	border: 1px solid color-mix(in srgb, var(--ph-accent-1) 35%, var(--ph-border));
	background:
		radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--ph-accent-1) 16%, transparent), transparent 70%),
		var(--ph-bg);
	overflow: hidden;
}
.ph-lock__icon {
	width: 64px; height: 64px; margin: 0 auto 12px;
	display: grid; place-items: center;
	border-radius: 20px;
	background: var(--ph-grad); background-size: 200% 100%;
	color: #fff; box-shadow: var(--ph-glow);
}
.ph-lock__icon .ph-icon { width: 30px; height: 30px; }
.ph-lock__icon .ph-shackle { transition: transform .5s var(--ph-ease); transform-origin: 16px 10px; }
.ph-lock__title { font-size: clamp(18px, 2.4vw, 22px); margin: 0 0 8px; }
.ph-price { background: var(--ph-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ph-price-old { color: var(--ph-muted); font-size: .75em; font-weight: 500; }
.ph-lock__teaser {
	position: relative; margin: 0 auto 14px; max-width: 520px;
	color: var(--ph-muted); font-style: italic;
	padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--ph-card) 70%, transparent);
}
.ph-lock__teaser span::before { content: "\201C"; }
.ph-lock__teaser span::after { content: "\201D"; }
.ph-lock__list { list-style: none; margin: 0 auto 18px; padding: 0; display: inline-flex; flex-direction: column; gap: 8px; text-align: left; }
.ph-lock__list li { display: flex; gap: 8px; align-items: flex-start; }
.ph-lock__list .ph-icon { color: var(--ph-success); margin-top: 2px; }
.ph-lock__owned { margin: 12px 0 0; font-size: 13px; color: var(--ph-muted); }
.ph-lock__owned a { color: var(--ph-rose); text-decoration: underline; }
.ph-lock__checking { position: absolute; left: 18px; right: 18px; bottom: 8px; opacity: .6; }
.ph-lock.is-checking .ph-btn--buy { opacity: .7; }

/* Lock-opening animation */
body:not(.ph-no-anim):not(.ph-no-lock) .ph-lock.is-opening .ph-shackle { transform: translateY(-3px) rotate(-28deg); }
body:not(.ph-no-anim):not(.ph-no-lock) .ph-lock.is-opening .ph-lock__icon { animation: ph-unlock-pop .6s var(--ph-ease) .25s both; }
body:not(.ph-no-anim):not(.ph-no-lock) .ph-lock.is-opening { animation: ph-lock-out .5s var(--ph-ease) .7s forwards; }
@keyframes ph-unlock-pop { 50% { transform: scale(1.15); box-shadow: 0 0 0 12px color-mix(in srgb, var(--ph-success) 25%, transparent); } 100% { background: var(--ph-success); } }
@keyframes ph-lock-out { to { opacity: 0; transform: scale(.96); } }

/* Unlocked content */
.ph-unlocked { display: flex; flex-direction: column; gap: 14px; }
.ph-unlocked.is-revealed { animation: ph-reveal-in .6s var(--ph-ease) both; }
@keyframes ph-reveal-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.ph-files { display: flex; flex-direction: column; gap: 8px; }
.ph-files__title { font: 700 13px/1 var(--ph-font-head); text-transform: uppercase; letter-spacing: .08em; color: var(--ph-rose); margin: 4px 0; }
.ph-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--ph-bg); border: 1px solid var(--ph-border); border-radius: 14px; }
.ph-file__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ph-left { color: var(--ph-muted); font-size: 11.5px; font-weight: 500; }
.ph-licensed { font-size: 12.5px; color: var(--ph-muted); margin: 0; }

/* ---------- Share & breadcrumbs ---------- */
.ph-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ph-share__label { color: var(--ph-muted); font-size: 13px; margin-right: 2px; }
.ph-share__btn {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 7px 12px; border-radius: 999px;
	background: var(--ph-bg); border: 1px solid var(--ph-border);
	color: var(--ph-text); font: 600 12.5px/1 var(--ph-font-head); cursor: pointer;
	transition: border-color .2s, transform .2s, color .2s;
}
.ph-share__btn:hover { border-color: var(--ph-accent-1); transform: translateY(-1px); }
.ph-share__btn--whatsapp:hover { color: #3ddc97; }
.ph-share__btn--telegram:hover { color: #6cc6ff; }
.ph-breadcrumbs ol { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--ph-muted); }
.ph-breadcrumbs li + li::before { content: "›"; margin-right: 6px; opacity: .6; }
.ph-breadcrumbs a:hover { color: var(--ph-rose); }
.ph-breadcrumbs [aria-current] span { color: var(--ph-text); }

/* ---------- My purchases ---------- */
.ph-purchases { margin: 0 0 32px; }
.ph-purchases__who { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--ph-muted); font-size: 13.5px; margin: 0 0 14px; }
.ph-purchases__list, .ph-purchases__body { display: grid; gap: 12px; }
.ph-purchase { display: flex; gap: 14px; padding: 14px; background: var(--ph-card); border: 1px solid var(--ph-border); border-radius: var(--ph-radius); align-items: flex-start; }
.ph-purchase__thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; }
.ph-purchase__main { flex: 1; min-width: 0; }
.ph-purchase__title { font-size: 16px; margin: 0 0 2px; }
.ph-purchase__meta { margin: 0 0 10px; font-size: 12.5px; }
.ph-purchase__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ph-purchase__bundle { margin: 10px 0 0; padding-left: 18px; color: var(--ph-muted); font-size: 13px; }
.ph-purchase--skel { align-items: center; }
.ph-purchase--skel .ph-skel--line { flex: 1; }
.ph-watermark-note { color: var(--ph-muted); font-size: 12.5px; margin: 14px 0 0; }
.ph-magic { background: var(--ph-card); border: 1px solid var(--ph-border); border-radius: var(--ph-radius); padding: 22px 18px; }
.ph-magic__form { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 6px; }
@media (min-width: 600px) { .ph-magic__form { flex-direction: row; } }
.ph-magic__msg { margin: 6px 0 0; color: var(--ph-muted); font-size: 13.5px; }

/* ---------- Forms (submission, checkout, magic link) ---------- */
.ph-scope input[type=text], .ph-scope input[type=email], .ph-scope input[type=url], .ph-scope input[type=number], .ph-scope textarea, .ph-scope select,
.ph-modal input[type=text], .ph-modal input[type=email] {
	width: 100%; min-width: 0;
	background: var(--ph-bg); color: var(--ph-text);
	border: 1px solid var(--ph-border); border-radius: 12px;
	padding: 12px 14px; font: 15px var(--ph-font-body);
	transition: border-color .2s, box-shadow .2s;
}
.ph-scope input:focus, .ph-scope textarea:focus, .ph-scope select:focus, .ph-modal input:focus {
	outline: 0; border-color: var(--ph-accent-1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ph-accent-1) 22%, transparent);
}
.ph-submit { display: flex; flex-direction: column; gap: 16px; background: var(--ph-card); border: 1px solid var(--ph-border); border-radius: var(--ph-radius); padding: 20px 16px; }
.ph-field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.ph-field label, .ph-field legend { font: 600 13.5px var(--ph-font-head); color: var(--ph-text); padding: 0; }
.ph-field__error { color: var(--ph-accent-2); font-size: 12.5px; margin: 0; min-height: 0; }
.ph-field.is-invalid input, .ph-field.is-invalid textarea, .ph-field.is-invalid .ph-drop { border-color: var(--ph-accent-2); }
.ph-field-row { display: grid; gap: 12px; }
@media (min-width: 700px) { .ph-field-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ph-req { color: var(--ph-accent-2); }
.ph-drop { position: relative; border: 1.5px dashed var(--ph-border); border-radius: var(--ph-radius); padding: 22px 16px; text-align: center; background: var(--ph-bg); transition: border-color .2s; }
.ph-drop.is-over { border-color: var(--ph-accent-1); }
.ph-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.ph-drop__preview { max-height: 220px; margin: 0 auto 10px; border-radius: 12px; }
.ph-drop__hint { color: var(--ph-muted); font-size: 13px; }
.ph-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.ph-check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500 !important; cursor: pointer; }
.ph-progress { height: 6px; border-radius: 6px; background: var(--ph-bg); overflow: hidden; }
.ph-progress__bar { display: block; height: 100%; width: 0; background: var(--ph-grad); transition: width .2s; }
.ph-submit__msg { margin: 0; min-height: 1.2em; color: var(--ph-muted); }
.ph-submit__msg.is-success { color: var(--ph-success); }
.ph-submit__msg.is-error { color: var(--ph-accent-2); }

/* ---------- Checkout modal ---------- */
.ph-modal { position: fixed; inset: 0; z-index: 99999; display: grid; place-items: end center; padding: 0; }
@media (min-width: 600px) { .ph-modal { place-items: center; padding: 16px; } }
.ph-modal__backdrop { position: absolute; inset: 0; background: rgba(5, 6, 18, .72); backdrop-filter: blur(4px); animation: ph-fade .2s ease both; }
.ph-modal__dialog {
	position: relative; width: 100%; max-width: 420px;
	background: var(--ph-card); border: 1px solid var(--ph-border);
	border-radius: 22px 22px 0 0; padding: 22px 18px 20px;
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
	animation: ph-sheet .32s var(--ph-ease) both;
	max-height: 92vh; overflow: auto;
}
@media (min-width: 600px) { .ph-modal__dialog { border-radius: 22px; } }
@keyframes ph-fade { from { opacity: 0; } }
@keyframes ph-sheet { from { transform: translateY(24px); opacity: 0; } }
.ph-modal__close { position: absolute; top: 12px; right: 12px; }
.ph-modal__item { display: flex; gap: 12px; align-items: center; margin: 0 0 16px; padding-right: 36px; }
.ph-modal__item img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; }
.ph-modal__item strong { display: block; font: 600 15px/1.3 var(--ph-font-head); }
.ph-modal form { display: flex; flex-direction: column; gap: 12px; }
.ph-modal label { font: 600 13px var(--ph-font-head); color: var(--ph-text); display: flex; flex-direction: column; gap: 6px; }
.ph-modal__coupon { display: flex; gap: 8px; }
.ph-modal__coupon input { flex: 1; text-transform: uppercase; }
.ph-modal__sum { display: grid; gap: 6px; padding: 12px 14px; border-radius: 14px; background: var(--ph-bg); border: 1px solid var(--ph-border); font-size: 14px; }
.ph-modal__sum div { display: flex; justify-content: space-between; }
.ph-modal__sum .is-total { font: 700 16px var(--ph-font-head); }
.ph-modal__msg { margin: 0; font-size: 13px; min-height: 1em; color: var(--ph-muted); }
.ph-modal__msg.is-error { color: var(--ph-accent-2); }
.ph-modal__secure { margin: 2px 0 0; text-align: center; font-size: 12px; color: var(--ph-muted); }
html.ph-modal-open { overflow: hidden; }

/* ---------- Toast & sparkle ---------- */
.ph-toast {
	position: fixed; left: 50%; bottom: 22px; z-index: 100000;
	transform: translate(-50%, 20px); opacity: 0;
	background: var(--ph-card); color: var(--ph-text);
	border: 1px solid var(--ph-border); border-radius: 999px;
	padding: 11px 18px; font: 600 14px var(--ph-font-head);
	box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .6);
	transition: opacity .25s, transform .25s var(--ph-ease);
	pointer-events: none; max-width: calc(100vw - 32px); text-align: center;
}
.ph-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.ph-toast.is-success { border-color: var(--ph-success); }
.ph-toast.is-error { border-color: var(--ph-accent-2); }
.ph-sparkle {
	position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; pointer-events: none;
	color: var(--ph-accent-1);
	animation: ph-sparkle .7s var(--ph-ease) forwards;
}
.ph-sparkle .ph-icon { width: 10px; height: 10px; }
@keyframes ph-sparkle {
	0% { transform: translate(-50%, -50%) scale(.3); opacity: 1; }
	100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(90deg); opacity: 0; }
}
body.ph-no-sparkle .ph-sparkle { display: none; }

/* ---------- Scroll reveal ---------- */
.ph-reveal.is-pending { opacity: 0; transform: translateY(18px); }
.ph-reveal.is-visible { opacity: 1; transform: none; transition: opacity .6s var(--ph-ease), transform .6s var(--ph-ease); }
body.ph-no-anim .ph-reveal, body.ph-no-fade .ph-reveal { opacity: 1 !important; transform: none !important; }

/* ---------- Archive ---------- */
.ph-archive { background: var(--ph-bg); }
.ph-archive__head { margin: 0 0 16px; }
.ph-archive__title { font-size: clamp(26px, 4vw, 40px); }
.ph-archive__desc { color: var(--ph-muted); max-width: 720px; }
.ph-content { margin: 0 0 28px; }

/* ---------- Motion safety ---------- */
@media (prefers-reduced-motion: reduce) {
	.ph-scope *, .ph-modal *, .ph-toast { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
	.ph-reveal.is-pending { opacity: 1; transform: none; }
}
body.ph-no-anim .ph-scope *, body.ph-no-anim .ph-modal * { animation: none !important; }
