/* Christmas Donation Tree – frontend. All rules scoped to .xdt-app. */

.xdt-app {
	--xdt-bg1: #0f172a;
	--xdt-bg2: #1e293b;
	--xdt-tree1: rgba(255, 255, 255, 0.1);
	--xdt-tree2: rgba(255, 255, 255, 0);
	/* Sizes: per-device values come from Settings → Appearance → Sizes (style attribute). */
	--xdt-deco-d: 2rem;
	--xdt-deco-t: 2rem;
	--xdt-deco-m: 1.5rem;
	--xdt-light-d: 0.375rem;
	--xdt-light-t: 0.375rem;
	--xdt-light-m: 0.2625rem;
	--xdt-deco: var(--xdt-deco-d);
	--xdt-light: var(--xdt-light-d);
	position: relative;
	box-sizing: border-box;
	padding: 2.5rem 1rem;
	background: linear-gradient(135deg, var(--xdt-bg1) 0%, var(--xdt-bg2) 100%);
	color: #fff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
	font-size: 1rem;
	line-height: 1.5;
	max-width: 100%;
	overflow: hidden;
	overflow-x: clip;
}

.xdt-app *,
.xdt-app *::before,
.xdt-app *::after {
	box-sizing: border-box;
}

.xdt-app [hidden] {
	display: none !important;
}

.xdt-app a {
	color: #fff;
}

/* Themes (e.g. WoodMart) colour labels and text elements globally; keep ours readable
   on the dark background. Elements that need another colour set it more specifically. */
.xdt-app label,
.xdt-app p,
.xdt-app span,
.xdt-app strong,
.xdt-app small,
.xdt-app li,
.xdt-app h2,
.xdt-app h3 {
	color: inherit;
}

/* Theme guards: WoodMart/Elementor style headings and form controls globally. */
.xdt-app h2,
.xdt-app h3 {
	font-family: inherit;
	font-style: normal;
	text-transform: none;
	letter-spacing: normal;
}

.xdt-app input[type="text"],
.xdt-app input[type="number"] {
	height: auto;
	min-height: 0;
	margin: 0;
	font-family: inherit;
	line-height: 1.3;
	box-sizing: border-box;
}

.xdt-app input[type="checkbox"] {
	margin: 0;
}

.xdt-app .xdt-field label,
.xdt-app .xdt-check,
.xdt-app .xdt-check span {
	color: #fff;
}

.xdt-app .xdt-header {
	text-align: center;
	margin: 0 auto 1.875rem;
	max-width: 75rem;
}

.xdt-app .xdt-title {
	color: #fff;
	font-size: clamp(1.5rem, 5vw, 2.5rem);
	margin: 0 0 0.625rem;
	line-height: 1.2;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.xdt-app .xdt-subtitle {
	font-size: clamp(0.9rem, 3vw, 1.1rem);
	opacity: 0.9;
	margin: 0;
}

.xdt-app .xdt-main {
	display: flex;
	flex-direction: column;
	gap: 1.875rem;
	align-items: center;
	max-width: 75rem;
	margin: 0 auto;
}

/* Panels & cards */
.xdt-app .xdt-panel,
.xdt-app .xdt-card {
	background: rgba(255, 255, 255, 0.1);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border-radius: 15px;
	padding: 1.5625rem;
	max-width: 37.5rem;
	width: 100%;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.xdt-app .xdt-card {
	margin: 0 auto;
	text-align: center;
	max-width: 32rem;
}

.xdt-app .xdt-panel-title {
	color: #fff;
	text-align: center;
	margin: 0 0 1.25rem;
	font-size: clamp(1.2rem, 4vw, 1.5rem);
}

/* Donation options */
.xdt-app .xdt-options {
	--xdt-opt-gap: 0.9375rem;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(8.75rem, 1fr));
	gap: var(--xdt-opt-gap);
}

.xdt-app .xdt-option-form {
	margin: 0;
	display: flex;
}

.xdt-app .xdt-option {
	width: 100%;
	background: rgba(255, 255, 255, 0.15);
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-radius: 12px;
	padding: 1.25rem 0.625rem;
	cursor: pointer;
	transition: all 0.3s ease;
	text-align: center;
	color: #fff;
	text-decoration: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	font: inherit;
	line-height: 1.3;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
}

.xdt-app .xdt-option:hover,
.xdt-app .xdt-option:focus-visible {
	background: rgba(255, 255, 255, 0.25);
	border-color: rgba(255, 255, 255, 0.5);
	transform: translateY(-3px);
	box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
	color: #fff;
}

.xdt-app .xdt-opt-emoji {
	font-size: clamp(2rem, 8vw, 3rem);
	line-height: 1;
}

.xdt-app .xdt-opt-name {
	max-width: 100%;
	overflow-wrap: anywhere;
	-webkit-hyphens: auto;
	hyphens: auto;
	font-weight: 600;
	font-size: clamp(0.85rem, 3vw, 1rem);
}

.xdt-app .xdt-opt-amount {
	font-size: clamp(0.75rem, 2.5vw, 0.9rem);
	opacity: 0.9;
}

/* Alerts */
.xdt-app .xdt-alert {
	border-radius: 12px;
	padding: 0.9375rem;
	text-align: center;
	margin: 0 0 1.25rem;
}

.xdt-app .xdt-alert-success {
	background: rgba(16, 185, 129, 0.2);
	border: 2px solid rgba(16, 185, 129, 0.5);
}

.xdt-app .xdt-alert-info {
	background: rgba(245, 158, 11, 0.2);
	border: 2px solid rgba(245, 158, 11, 0.5);
}

.xdt-app .xdt-alert-error {
	background: rgba(239, 68, 68, 0.2);
	border: 2px solid rgba(239, 68, 68, 0.5);
}

.xdt-app .xdt-donor-status .xdt-alert:last-child {
	margin-bottom: 1.25rem;
}

/* Tree */
.xdt-app .xdt-tree {
	position: relative;
	width: 100%;
	max-width: 31.25rem;
	aspect-ratio: 2 / 3;
	background: radial-gradient(ellipse at center, var(--xdt-tree1) 0%, var(--xdt-tree2) 70%);
	border-radius: 20px;
	margin: 0 auto;
	overflow: hidden;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	/* Repeated taps (placing/moving) must not trigger double-tap zoom on phones. */
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	-webkit-user-select: none;
	user-select: none;
}

.xdt-app .xdt-options,
.xdt-app .xdt-colors,
.xdt-app .xdt-btn,
.xdt-app .xdt-badge {
	touch-action: manipulation;
}

.xdt-app .xdt-tree-svg,
.xdt-app .xdt-tree-img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: contain;
	pointer-events: none;
	user-select: none;
}

.xdt-app .xdt-layer {
	position: absolute;
	inset: 0;
	z-index: 2; /* decorations in front of the tree lights (z-index 1) */
	pointer-events: none;
}

.xdt-app .xdt-decoration {
	position: absolute;
	font-size: var(--xdt-deco);
	line-height: 1;
	cursor: pointer;
	transform: translate(-50%, -50%);
	animation: xdt-fade-in 0.5s ease-in;
	filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.3));
	user-select: none;
	transition: transform 0.2s;
	pointer-events: all;
	background: none;
	border: 0;
	padding: 0;
	color: inherit;
}

.xdt-app .xdt-layer .xdt-decoration:hover,
.xdt-app .xdt-layer .xdt-decoration:focus-visible {
	transform: translate(-50%, -50%) scale(1.2);
}

/* Decorations are <button>s for keyboard access. Themes such as WoodMart style every
   button (background, 13px uppercase text, min-height, padding), so reset them here
   with enough specificity to win. */
.xdt-app .xdt-layer .xdt-decoration {
	display: block;
	width: auto;
	height: auto;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font-family: inherit;
	font-size: var(--xdt-deco);
	font-weight: normal;
	line-height: 1;
	letter-spacing: normal;
	text-transform: none;
	outline-offset: 2px;
}

.xdt-app .xdt-layer .xdt-decoration:hover,
.xdt-app .xdt-layer .xdt-decoration:focus,
.xdt-app .xdt-layer .xdt-decoration:active {
	background: none;
	box-shadow: none;
	color: inherit;
}

/* Same protection for the plugin's other buttons. */
.xdt-app button.xdt-option,
.xdt-app button.xdt-color-btn,
.xdt-app button.xdt-btn,
.xdt-app button.xdt-modal-close {
	min-width: 0;
	min-height: 0;
	height: auto;
	letter-spacing: normal;
	text-transform: none;
	font-family: inherit;
}

.xdt-app button.xdt-option {
	display: flex;
	font-weight: normal;
	line-height: 1.3;
}

.xdt-app button.xdt-color-btn {
	display: block;
	font-size: 3rem;
	line-height: 1;
}

.xdt-app button.xdt-btn {
	display: block;
	font-size: 1.1rem;
	font-weight: 600;
	line-height: 1.3;
}

.xdt-app button.xdt-modal-close {
	display: inline-block;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
}

@keyframes xdt-fade-in {
	from { opacity: 0; transform: translate(-50%, -50%) scale(0); }
	to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Placement */
.xdt-app .xdt-place {
	max-width: 56.25rem;
	margin: 0 auto;
}

.xdt-app .xdt-place .xdt-panel {
	margin: 0 auto 1.5625rem;
}

.xdt-app .xdt-thanks {
	max-width: 37.5rem;
	margin-left: auto;
	margin-right: auto;
}

.xdt-app .xdt-tree-placing {
	cursor: crosshair;
	margin-bottom: 1.25rem;
}

.xdt-app .xdt-tree-placing .xdt-decoration {
	opacity: 0.5;
	filter: grayscale(0.5);
	cursor: default;
	pointer-events: none;
	animation: none;
}

.xdt-app .xdt-preview {
	position: absolute;
	z-index: 3;
	font-size: var(--xdt-deco);
	line-height: 1;
	pointer-events: none;
	transform: translate(-50%, -50%);
	opacity: 0.7;
}

.xdt-app .xdt-preview.xdt-is-set {
	opacity: 1;
}

.xdt-app .xdt-instruction {
	text-align: center;
	margin: 0 0 1.25rem;
	font-size: 1.1rem;
	opacity: 0.9;
}

.xdt-app .xdt-autosave-hint {
	display: block;
	margin-top: 0.375rem;
	font-size: 0.9rem;
	opacity: 0.8;
}

.xdt-app .xdt-place-status {
	max-width: 25rem;
	margin: 0 auto 1rem;
	padding: 0.625rem 0.9375rem;
	border-radius: 10px;
	background: rgba(16, 185, 129, 0.2);
	border: 2px solid rgba(16, 185, 129, 0.5);
	text-align: center;
	font-weight: 600;
}

.xdt-app .xdt-mine-item .xdt-badge-move {
	margin-left: 0.375rem;
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
	text-decoration: none;
}

.xdt-app .xdt-place-error {
	max-width: 25rem;
	margin: 0 auto 1rem;
}

/* Forms */
.xdt-app .xdt-field {
	margin: 1.25rem 0;
	text-align: left;
}

.xdt-app .xdt-field label {
	display: block;
	margin-bottom: 0.5rem;
	font-weight: 500;
}

.xdt-app .xdt-field input[type="text"],
.xdt-app .xdt-field input[type="number"] {
	width: 100%;
	padding: 0.75rem;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	/* At least 16px: iOS Safari zooms into any field with smaller text, and themes
	   like WoodMart set the root size (1rem) to 14px. */
	font-size: max(1rem, 16px);
	box-shadow: none;
}

.xdt-app .xdt-field input[type="number"] {
	font-size: max(1.5rem, 16px);
	text-align: center;
}

.xdt-app .xdt-field input:focus {
	outline: none;
	border-color: rgba(255, 255, 255, 0.6);
}

.xdt-app .xdt-field input::placeholder {
	color: rgba(255, 255, 255, 0.5);
}

.xdt-app .xdt-check {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.9375rem;
	background: rgba(255, 255, 255, 0.05);
	border-radius: 8px;
	cursor: pointer;
	line-height: 1.5;
}

.xdt-app .xdt-check input {
	width: 1.5rem;
	height: 1.5rem;
	margin: 0.125rem 0 0;
	flex: 0 0 auto;
	cursor: pointer;
}

.xdt-app .xdt-hint {
	display: block;
	margin: 0.75rem 0 0;
	font-size: 0.9rem;
	opacity: 0.8;
	text-align: center;
}

.xdt-app .xdt-big-emoji {
	font-size: 3.5rem;
	line-height: 1.2;
	margin-bottom: 0.625rem;
}

.xdt-app .xdt-colors {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1.25rem;
	margin: 1.875rem 0;
}

@media (min-width: 768px) {
	.xdt-app .xdt-colors {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.xdt-app .xdt-color-btn {
	padding: 1.25rem;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.1);
	cursor: pointer;
	transition: all 0.3s;
	font-size: 3rem;
	line-height: 1;
	color: inherit;
	box-shadow: none;
}

.xdt-app .xdt-color-btn:hover,
.xdt-app .xdt-color-btn:focus-visible {
	transform: scale(1.1);
	border-color: rgba(255, 255, 255, 0.8);
	background: rgba(255, 255, 255, 0.15);
}

/* Buttons */
.xdt-app .xdt-btn {
	display: block;
	width: 100%;
	max-width: 25rem;
	margin: 1.25rem auto 0;
	padding: 0.9375rem;
	background: rgba(255, 255, 255, 0.9);
	color: #333;
	border: none;
	border-radius: 10px;
	font-size: 1.1rem;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	cursor: pointer;
	transition: all 0.3s;
	box-shadow: none;
}

.xdt-app .xdt-btn:hover:not(:disabled) {
	background: #fff;
	color: #333;
	transform: translateY(-2px);
	box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.xdt-app .xdt-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.xdt-app .xdt-btn-secondary {
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
}

.xdt-app .xdt-btn-secondary:hover:not(:disabled) {
	background: rgba(255, 255, 255, 0.3);
	color: #fff;
}

/* My decorations */
.xdt-app .xdt-stats {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	background: rgba(255, 255, 255, 0.08);
	border-radius: 10px;
	padding: 0.9375rem;
	margin-bottom: 1.25rem;
}

.xdt-app .xdt-mine-list {
	list-style: none;
	margin: 0;
	padding: 0;
	text-align: left;
}

.xdt-app .xdt-mine-item {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.9375rem;
	padding: 0.75rem 0.9375rem;
	margin: 0 0 0.625rem;
	background: rgba(255, 255, 255, 0.08);
	border-radius: 10px;
}

.xdt-app .xdt-mine-emoji {
	font-size: 2rem;
	line-height: 1;
}

.xdt-app .xdt-mine-info {
	flex: 1 1 8rem;
	min-width: 0;
}

.xdt-app .xdt-badge {
	margin-left: auto;
	padding: 0.375rem 0.75rem;
	border-radius: 20px;
	font-size: 0.85rem;
	white-space: nowrap;
}

.xdt-app .xdt-badge-ok {
	background: rgba(16, 185, 129, 0.3);
}

.xdt-app .xdt-badge-action {
	background: rgba(255, 255, 255, 0.9);
	color: #333;
	text-decoration: none;
	font-weight: 600;
}

/* Modal */
.xdt-app .xdt-modal {
	position: fixed;
	z-index: 100000;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	display: flex;
	align-items: center;
	justify-content: center;
}

.xdt-app .xdt-modal-content {
	background: #fff;
	color: #333;
	border-radius: 15px;
	padding: 1.875rem;
	max-width: 25rem;
	width: 90%;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
	text-align: center;
}

.xdt-app .xdt-modal-emoji {
	font-size: 4rem;
	line-height: 1.2;
	margin-bottom: 0.9375rem;
}

.xdt-app .xdt-modal-content h3 {
	margin: 0 0 0.625rem;
	color: #667eea;
	font-size: 1.4rem;
}

.xdt-app .xdt-modal-content p {
	margin: 0.625rem 0;
	color: #666;
}

.xdt-app .xdt-modal-close {
	margin-top: 1.25rem;
	padding: 0.625rem 1.5625rem;
	background: #667eea;
	color: #fff;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	font-size: 1rem;
}

.xdt-app .xdt-modal-close:hover {
	background: #5568d3;
}

/* Footer */
.xdt-app .xdt-custom-html {
	text-align: center;
	margin: 1.875rem auto 0;
	padding: 1.25rem;
	opacity: 0.9;
	max-width: 75rem;
}

.xdt-app .xdt-footer {
	text-align: center;
	margin-top: 2.5rem;
	opacity: 0.7;
	font-size: 0.85rem;
}

.xdt-app .xdt-footer p {
	margin: 0 0 0.625rem;
}

/* Snow & lights */
.xdt-app .xdt-snowflake {
	position: absolute;
	top: -0.625rem;
	z-index: 0;
	color: #fff;
	opacity: 0.6;
	pointer-events: none;
	user-select: none;
	animation: xdt-snowfall 10s linear infinite;
}

.xdt-app .xdt-main,
.xdt-app .xdt-header,
.xdt-app .xdt-card,
.xdt-app .xdt-place,
.xdt-app .xdt-footer,
.xdt-app .xdt-custom-html {
	position: relative;
	z-index: 1;
}

@keyframes xdt-snowfall {
	0% { transform: translateY(0) rotate(0deg); opacity: 0.6; }
	100% { transform: translateY(var(--xdt-fall, 100vh)) rotate(360deg); opacity: 0; }
}

.xdt-app .xdt-light {
	position: absolute;
	margin: calc(var(--xdt-light) / -2) 0 0 calc(var(--xdt-light) / -2);
	width: var(--xdt-light);
	height: var(--xdt-light);
	border-radius: 50%;
	animation: xdt-twinkle 2s ease-in-out infinite;
	pointer-events: none;
	z-index: 1;
}

.xdt-app .xdt-light.xdt-light-red { background: #f00; box-shadow: 0 0 calc(var(--xdt-light) * 1.7) #f00; }
.xdt-app .xdt-light.xdt-light-green { background: #0f0; box-shadow: 0 0 calc(var(--xdt-light) * 1.7) #0f0; }
.xdt-app .xdt-light.xdt-light-blue { background: #0080ff; box-shadow: 0 0 calc(var(--xdt-light) * 1.7) #0080ff; }
.xdt-app .xdt-light.xdt-light-yellow { background: #ff0; box-shadow: 0 0 calc(var(--xdt-light) * 1.7) #ff0; }
.xdt-app .xdt-light.xdt-light-white { background: #fff; box-shadow: 0 0 calc(var(--xdt-light) * 1.7) #fff; }

@keyframes xdt-twinkle {
	0%, 100% { opacity: 0.3; transform: scale(0.8); }
	50% { opacity: 1; transform: scale(1.2); }
}

/* Tablet sizes (769–1024px) */
@media (max-width: 1024px) {
	.xdt-app {
		--xdt-deco: var(--xdt-deco-t);
		--xdt-light: var(--xdt-light-t);
	}
}

@media (max-width: 768px) {
	.xdt-app .xdt-options {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	/* Odd number of tiles: centre the last one at single-column width. */
	.xdt-app .xdt-options > :last-child:nth-child(odd) {
		grid-column: 1 / -1;
		justify-self: center;
		width: calc((100% - var(--xdt-opt-gap)) / 2);
	}
	/* Mobile sizes */
	.xdt-app {
		--xdt-deco: var(--xdt-deco-m);
		--xdt-light: var(--xdt-light-m);
	}
	.xdt-app .xdt-panel,
.xdt-app .xdt-card {
		padding: 1.25rem;
	}
}

/* Custom amount step: centred label above the centred amount field */
.xdt-app.xdt-view-choose .xdt-field label {
	text-align: center;
}

/* Comfortable tap targets for inline links */
.xdt-app .xdt-donor-status a,
.xdt-app .xdt-mine-link a,
.xdt-app .xdt-empty a {
	display: inline-block;
	padding: 0.5rem 0.25rem;
}

/* Small phones */
@media (max-width: 480px) {
	.xdt-app {
		padding: 1.5rem 0.625rem;
	}
	.xdt-app .xdt-panel,
.xdt-app .xdt-card {
		padding: 0.875rem;
		border-radius: 12px;
	}
	.xdt-app .xdt-options {
		--xdt-opt-gap: 0.625rem;
	}
	.xdt-app .xdt-option {
		padding: 0.875rem 0.375rem;
	}
	.xdt-app .xdt-alert {
		padding: 0.75rem;
		margin-bottom: 0.875rem;
	}
	.xdt-app .xdt-colors {
		gap: 0.75rem;
		margin: 1.25rem 0;
	}
	.xdt-app .xdt-color-btn,
.xdt-app button.xdt-color-btn {
		padding: 0.875rem;
		font-size: 2.5rem;
	}
	.xdt-app .xdt-mine-item {
		gap: 0.625rem;
		padding: 0.625rem;
	}
	.xdt-app .xdt-tree {
		border-radius: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.xdt-app .xdt-snowflake,
.xdt-app .xdt-light,
.xdt-app .xdt-decoration {
		animation: none;
	}
}
