/* Gamification Jampaa – front end
 *
 * Sizes are in px and the contested properties use !important on purpose: many themes style
 * every <button> (padding, width, colours, hover) and set a small root font size, which would
 * otherwise change the look of the popup and of the hidden logo.
 */

/* Popup */
.pslh-dialog {
	box-sizing: border-box;
	width: calc(100% - 32px);
	max-width: 680px;
	max-height: calc(100% - 32px);
	overflow: auto;
	margin: auto;
	padding: 48px 36px 36px;
	border: 0;
	border-radius: 14px;
	background: #fff;
	color: #1a1a1a;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
	font-size: 17px !important;
	line-height: 1.5 !important;
	text-align: center;
}
.pslh-dialog::backdrop { background: rgba(10, 15, 30, .6); }
.pslh-dialog--fallback {
	position: fixed;
	inset: 0;
	height: fit-content;
	z-index: 2147483000;
	box-shadow: 0 0 0 100vmax rgba(10, 15, 30, .6);
}
.pslh-dialog *, .pslh-dialog *::before, .pslh-dialog *::after { box-sizing: border-box; }
.pslh-dialog [hidden] { display: none !important; }
.pslh-dialog .pslh-title {
	margin: 0 0 12px !important;
	color: var(--pslh-primary);
	font-size: 30px !important;
	line-height: 1.2 !important;
}
.pslh-dialog .pslh-text { margin: 0 0 8px !important; font-size: 20px !important; line-height: 1.4 !important; font-style: italic; }
.pslh-dialog .pslh-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 24px; }
.pslh-dialog .pslh-error { margin: 16px 0 0; color: #b42318; font-weight: 600; }
.pslh-dialog .pslh-rules-wrap {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 24px;
	align-items: center;
	text-align: left;
}
.pslh-dialog .pslh-rules,
.pslh-dialog .pslh-rules li,
.pslh-dialog .pslh-rules p { font-size: 17px !important; line-height: 1.5 !important; }
.pslh-dialog .pslh-rules ol, .pslh-dialog .pslh-rules ul { margin: 0 0 12px !important; padding-left: 22px !important; }
.pslh-dialog .pslh-rules li { margin: 0 0 6px !important; }
.pslh-dialog .pslh-rules p { margin: 0 !important; font-weight: 600; }
.pslh-dialog .pslh-preview { margin: 0; text-align: center; }
.pslh-dialog .pslh-preview img { display: block; width: 140px; height: 140px; max-width: none; margin: 0 auto 6px; object-fit: contain; }
.pslh-dialog .pslh-preview figcaption { font-size: 20px !important; line-height: 1.3 !important; font-style: italic; }

/* Buttons. Themes often style every <button> with rules such as
   "body button:not(:hover):not(:active) { padding: … !important; width: auto !important }".
   The box model below is scoped with :not(#pslh-x) (an ID-level specificity no theme class rule reaches),
   so the buttons keep the same size in every state. Colours and radius keep a normal specificity:
   a site can still restyle them. */
.pslh-dialog button.pslh-btn:not(#pslh-x) {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: auto !important;
	max-width: none !important;
	min-height: 48px !important;
	margin: 0 !important;
	padding: 12px 26px !important;
	border-width: 2px !important;
	border-style: solid !important;
	box-shadow: none !important;
	font-size: 18px !important;
	font-weight: 600 !important;
	line-height: 1.2 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	transform: none !important;
	cursor: pointer;
}
.pslh-dialog button.pslh-btn,
.pslh-dialog button.pslh-btn:hover,
.pslh-dialog button.pslh-btn:focus,
.pslh-dialog button.pslh-btn:active {
	border-color: var(--pslh-primary) !important;
	border-radius: var(--pslh-radius, 8px) !important;
	font-family: inherit;
	transition: background-color .15s ease, color .15s ease, filter .15s ease !important;
}
.pslh-dialog button.pslh-btn--primary,
.pslh-dialog button.pslh-btn--primary:hover,
.pslh-dialog button.pslh-btn--primary:focus,
.pslh-dialog button.pslh-btn--primary:active { background: var(--pslh-primary) !important; color: var(--pslh-on-primary) !important; }
.pslh-dialog button.pslh-btn--ghost,
.pslh-dialog button.pslh-btn--ghost:hover,
.pslh-dialog button.pslh-btn--ghost:focus,
.pslh-dialog button.pslh-btn--ghost:active { background: transparent !important; color: var(--pslh-primary) !important; }
.pslh-dialog button.pslh-btn:hover { filter: brightness(1.12); }
.pslh-dialog button.pslh-btn:disabled { opacity: .6; cursor: wait; }
.pslh-dialog button.pslh-btn:focus-visible,
.pslh-dialog button.pslh-close:focus-visible { outline: 3px solid var(--pslh-primary) !important; outline-offset: 3px; }

.pslh-dialog button.pslh-close:not(#pslh-x) {
	position: absolute !important;
	top: 8px !important;
	right: 8px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 44px !important;
	height: 44px !important;
	max-width: none !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	box-shadow: none !important;
	font-family: Arial, sans-serif !important;
	font-size: 30px !important;
	font-weight: 400 !important;
	line-height: 1 !important;
	transform: none !important;
	cursor: pointer;
}
.pslh-dialog button.pslh-close,
.pslh-dialog button.pslh-close:hover,
.pslh-dialog button.pslh-close:focus,
.pslh-dialog button.pslh-close:active {
	border-radius: 50% !important;
	background: transparent !important;
	color: #333 !important;
}
.pslh-dialog button.pslh-close:hover { background: rgba(0, 0, 0, .06) !important; }

@media (max-width: 600px) {
	.pslh-dialog { padding: 44px 20px 24px; }
	.pslh-dialog .pslh-title { font-size: 25px !important; }
	.pslh-dialog .pslh-rules-wrap { grid-template-columns: 1fr; }
	.pslh-dialog .pslh-preview { order: -1; }
	.pslh-dialog .pslh-preview img { width: 96px; height: 96px; }
	.pslh-dialog button.pslh-btn:not(#pslh-x) { width: 100% !important; }
}

/* Hidden logo. The size comes from the inline height + aspect-ratio, so it survives
   themes that force "width: auto !important" on every button. */
button.pslh-logo,
button.pslh-logo:hover,
button.pslh-logo:focus,
button.pslh-logo:active {
	position: absolute !important;
	z-index: 5;
	display: block !important;
	box-sizing: border-box !important;
	aspect-ratio: 1 / 1;
	border: 0 !important;
	border-radius: 50% !important;
	background: transparent !important;
	box-shadow: none !important;
	line-height: 0 !important;
	font-size: 0 !important;
	cursor: pointer;
	transform: rotate(var(--pslh-rot, 0deg));
	transition: transform .2s ease !important;
	animation: pslh-pop .4s ease-out both;
}
.pslh-logo img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	object-fit: contain;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35));
	pointer-events: none;
}
/* Box model scoped with :not(#pslh-x): stronger than theme rules such as "body button { padding: … !important }". */
button.pslh-logo:not(#pslh-x) {
	width: auto !important;
	max-width: none !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
}
button.pslh-logo:hover { transform: rotate(var(--pslh-rot, 0deg)) scale(1.08); }

/* Optional round badge behind the logo (Appearance > Logo badge): makes light logos visible on any photo. */
button.pslh-logo.pslh-logo--badge,
button.pslh-logo.pslh-logo--badge:hover,
button.pslh-logo.pslh-logo--badge:focus,
button.pslh-logo.pslh-logo--badge:active {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	border: 3px solid var(--pslh-badge-border) !important;
	background: var(--pslh-badge-bg) !important;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .35) !important;
}
.pslh-logo--badge img { width: 66% !important; height: 66% !important; filter: none; }
.pslh-dialog--badge .pslh-preview img {
	box-sizing: border-box;
	padding: 22px;
	border: 3px solid var(--pslh-badge-border);
	border-radius: 50%;
	background: var(--pslh-badge-bg);
}
button.pslh-logo:focus-visible { outline: 3px solid #fff !important; box-shadow: 0 0 0 6px var(--pslh-primary) !important; }
button.pslh-logo:disabled { cursor: wait; }
@keyframes pslh-pop { from { opacity: 0; transform: rotate(var(--pslh-rot, 0deg)) scale(.6); } }

/* Messages and confetti */
.pslh-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 2147483000;
	max-width: calc(100% - 32px);
	padding: 16px 24px;
	border-radius: 10px;
	background: var(--pslh-primary);
	color: var(--pslh-on-primary);
	box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
	font-size: 19px;
	font-weight: 700;
	line-height: 1.3;
	text-align: center;
	transform: translateX(-50%);
}
.pslh-confetti { position: fixed; inset: 0; z-index: 2147483001; width: 100%; height: 100%; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
	button.pslh-logo, .pslh-dialog button.pslh-btn { animation: none; transition: none !important; }
}
