/**
 * Earn Dashboard — captcha challenge widget.
 *
 * Sits inside article content, where the theme styles h3, p, input and button.
 * Every rule is scoped to .earn-cap with enough specificity to beat those, and
 * buttons pin every interactive state so the theme's black hover cannot appear.
 */

.earn-cap {
	--cap-ink: #14101f;
	--cap-soft: #4a4360;
	--cap-faint: #6b6584;
	--cap-line: #e7e2f3;

	position: relative;
	margin: 30px 0;
	padding: 2px;
	border-radius: 22px;
	background: linear-gradient(135deg, #ec4899, #a855f7 45%, #7c3aed);
	box-shadow: 0 22px 50px -30px rgba(168, 85, 247, .95);
	font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
	color: var(--cap-ink);
	line-height: 1.5;
	letter-spacing: .005em;
}

.earn-cap *,
.earn-cap *::before,
.earn-cap *::after {
	box-sizing: border-box;
	font-family: inherit;
}

/* Inner surface, so the gradient reads as a border. */
.earn-cap__head,
.earn-cap__body,
.earn-cap__foot { background: #ffffff; }

.earn-cap__head {
	display: flex;
	align-items: center;
	gap: 13px;
	padding: 18px 20px 14px;
	border-radius: 20px 20px 0 0;
}

.earn-cap__badge {
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	flex: 0 0 46px;
	border-radius: 14px;
	background: linear-gradient(135deg, #ec4899, #7c3aed);
	color: #ffffff;
	box-shadow: 0 10px 22px -12px rgba(124, 58, 237, .95);
}

.earn-cap__titles { flex: 1 1 auto; min-width: 0; }

.earn-cap .earn-cap__eyebrow {
	margin: 0 0 2px;
	font-size: 10.5px;
	font-weight: 800;
	letter-spacing: .13em;
	text-transform: uppercase;
	color: #9333ea;
}

.earn-cap h3.earn-cap__title,
.earn-cap .earn-cap__title {
	margin: 0;
	padding: 0;
	font-size: 19px;
	font-weight: 800;
	line-height: 1.25;
	letter-spacing: -.015em;
	color: var(--cap-ink);
	text-transform: none;
	border: 0;
}

.earn-cap__reward {
	flex: 0 0 auto;
	padding: 8px 15px;
	border-radius: 999px;
	background: linear-gradient(135deg, #059669, #10b981);
	color: #ffffff;
	font-size: 15px;
	font-weight: 800;
	letter-spacing: -.01em;
	box-shadow: 0 10px 20px -12px rgba(16, 185, 129, .95);
	white-space: nowrap;
}

.earn-cap__body { padding: 4px 20px 18px; }

/* ------------------------------------------------------------- loading */

.earn-cap__loading {
	height: 150px;
	border-radius: 16px;
	overflow: hidden;
	background: #f6f3fd;
}

.earn-cap__shimmer {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .85) 50%, transparent 80%);
	background-size: 200% 100%;
	animation: capShimmer 1.4s linear infinite;
}

@keyframes capShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* -------------------------------------------------------------- guest */

.earn-cap__guest {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	padding: 16px 18px;
	border-radius: 16px;
	background: linear-gradient(90deg, #faf5ff, #fdf2f8);
}

.earn-cap .earn-cap__guest p { margin: 0; font-size: 15px; font-weight: 600; color: var(--cap-soft); }

/* --------------------------------------------------------------- play */

.earn-cap__image-row {
	display: flex;
	align-items: center;
	gap: 11px;
	margin-bottom: 13px;
}

.earn-cap__frame {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	border: 1px solid var(--cap-line);
	border-radius: 16px;
	background: #f6f3fd;
	line-height: 0;
}

.earn-cap .earn-cap__img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	aspect-ratio: 280 / 92;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	image-rendering: auto;
	transition: opacity .25s, filter .25s;
}

.earn-cap.is-swapping .earn-cap__img { opacity: .35; filter: blur(2px); }

.earn-cap .earn-cap__refresh,
.earn-cap .earn-cap__refresh:hover,
.earn-cap .earn-cap__refresh:focus,
.earn-cap .earn-cap__refresh:active {
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	min-width: 46px;
	flex: 0 0 46px;
	padding: 0;
	border: 1px solid #ddd2f7;
	border-radius: 14px;
	background: #f6f1ff;
	background-image: none;
	color: #7c3aed;
	box-shadow: none;
	text-transform: none;
	cursor: pointer;
	transition: background .2s, border-color .2s;
}

.earn-cap .earn-cap__refresh:hover { background: #ede4ff; border-color: #a78bfa; }
.earn-cap .earn-cap__refresh svg { transition: transform .45s cubic-bezier(.2, .8, .3, 1); }
.earn-cap .earn-cap__refresh.is-spinning svg { transform: rotate(-360deg); }

.earn-cap__answer { display: flex; gap: 10px; }

.earn-cap .earn-cap__input,
.earn-cap .earn-cap__input:focus {
	flex: 1 1 auto;
	min-width: 0;
	height: 54px;
	margin: 0;
	padding: 0 16px;
	border: 2px solid var(--cap-line);
	border-radius: 14px;
	background: #ffffff;
	color: var(--cap-ink);
	font-size: 22px;
	font-weight: 800;
	letter-spacing: .32em;
	text-transform: uppercase;
	text-align: center;
	box-shadow: none;
	outline: none;
	transition: border-color .2s, box-shadow .2s;
}

.earn-cap .earn-cap__input::placeholder {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .02em;
	text-transform: none;
	color: #9a94b0;
}

.earn-cap .earn-cap__input:focus {
	border-color: #a855f7;
	box-shadow: 0 0 0 4px rgba(168, 85, 247, .16);
}

/* Buttons: gradient, and the same in every state. */
.earn-cap .earn-cap__btn,
.earn-cap .earn-cap__btn:hover,
.earn-cap .earn-cap__btn:focus,
.earn-cap .earn-cap__btn:active {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 54px;
	margin: 0;
	padding: 0 26px;
	border: 0;
	border-radius: 14px;
	background: linear-gradient(135deg, #ec4899 0%, #a855f7 55%, #7c3aed 100%);
	background-color: #a855f7;
	color: #ffffff;
	font-size: 15.5px;
	font-weight: 800;
	line-height: 1;
	letter-spacing: 0;
	text-transform: none;
	text-shadow: none;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: 0 12px 24px -12px rgba(168, 85, 247, .95);
	transition: transform .2s cubic-bezier(.2, .8, .3, 1), box-shadow .2s, filter .2s;
}

.earn-cap .earn-cap__btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.earn-cap .earn-cap__btn[disabled] { opacity: .6; cursor: progress; transform: none; }
.earn-cap .earn-cap__guest .earn-cap__btn { height: 46px; padding: 0 22px; }

.earn-cap .earn-cap__btn:focus-visible,
.earn-cap .earn-cap__refresh:focus-visible {
	outline: 2px solid #7c3aed;
	outline-offset: 3px;
}

.earn-cap .earn-cap__msg {
	margin: 12px 0 0;
	padding: 10px 14px;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 600;
}

.earn-cap .earn-cap__msg--error { background: #fff1f3; color: #be123c; border: 1px solid #fecdd6; }
.earn-cap .earn-cap__msg--info { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }

.earn-cap .earn-cap__hint {
	margin: 9px 2px 0;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--cap-faint);
}

/* --------------------------------------------------------------- done */

.earn-cap__done {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 18px;
	border-radius: 16px;
	background: linear-gradient(135deg, #ecfdf5, #f0fdfa);
	border: 1px solid #a7f3d0;
}

.earn-cap__check {
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	flex: 0 0 52px;
	border-radius: 50%;
	background: linear-gradient(135deg, #059669, #10b981);
	color: #ffffff;
	box-shadow: 0 10px 22px -10px rgba(16, 185, 129, .95);
}

.earn-cap.is-win .earn-cap__check { animation: capPop .6s cubic-bezier(.2, .9, .3, 1.4); }

@keyframes capPop {
	0% { transform: scale(.3); opacity: 0; }
	60% { transform: scale(1.15); opacity: 1; }
	100% { transform: scale(1); }
}

.earn-cap .earn-cap__done b { display: block; font-size: 16.5px; font-weight: 800; color: #047857; }
.earn-cap .earn-cap__done p { margin: 3px 0 0; font-size: 14px; color: var(--cap-soft); }

/* Recharge bar: fills over the cooldown, with no ticking clock. */
.earn-cap .earn-cap__recharge-label {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin: 4px 0 7px;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--cap-soft);
}

.earn-cap .earn-cap__recharge-pct {
	font-weight: 800;
	color: #047857;
	font-variant-numeric: tabular-nums;
}

.earn-cap__recharge {
	height: 9px;
	border-radius: 999px;
	background: #d1fae5;
	overflow: hidden;
}

.earn-cap__recharge-fill {
	display: block;
	height: 100%;
	width: 0;
	min-width: 6px;
	border-radius: 999px;
	background: linear-gradient(90deg, #10b981, #34d399);
	transition: width .8s cubic-bezier(.2, .8, .3, 1);
}

/* The done panel's text column takes the free width so the bar is long. */
.earn-cap__done > div { flex: 1 1 auto; min-width: 0; }

/* --------------------------------------------------------------- foot */

.earn-cap .earn-cap__foot {
	margin: 0;
	padding: 0 20px 16px;
	border-radius: 0 0 20px 20px;
	font-size: 12.5px;
	color: var(--cap-faint);
}

.earn-cap-admin-note {
	padding: 10px 14px;
	border: 1px dashed #c084fc;
	border-radius: 10px;
	color: #6d28d9;
	font-size: 14px;
}

/* --------------------------------------------------------------- motion */

.earn-cap.is-shake .earn-cap__answer { animation: capShake .42s cubic-bezier(.36, .07, .19, .97); }

@keyframes capShake {
	10%, 90% { transform: translateX(-2px); }
	20%, 80% { transform: translateX(4px); }
	30%, 50%, 70% { transform: translateX(-7px); }
	40%, 60% { transform: translateX(7px); }
}

@media ( max-width: 560px ) {
	.earn-cap__head { flex-wrap: wrap; padding: 16px 16px 12px; }
	.earn-cap__reward { order: 3; }
	.earn-cap__body { padding: 4px 16px 16px; }
	.earn-cap__answer { flex-direction: column; }
	.earn-cap .earn-cap__btn { width: 100%; }
	.earn-cap .earn-cap__input { font-size: 20px; letter-spacing: .26em; }
	.earn-cap .earn-cap__foot { padding: 0 16px 14px; }
}

@media ( prefers-reduced-motion: reduce ) {
	.earn-cap__shimmer,
	.earn-cap.is-shake .earn-cap__answer,
	.earn-cap.is-win .earn-cap__check { animation: none; }
	.earn-cap .earn-cap__btn:hover { transform: none; }
	.earn-cap .earn-cap__refresh svg { transition: none; }
}

/* The widget switches states with the hidden attribute. The state containers
   set display:flex above, which beats the browser's own [hidden] rule, so all
   four states showed at once. This scoped rule is more specific and wins. */
.earn-cap [hidden] { display: none; }

/* --------------------------------------------- round progress (Code 1 of 2) */

.earn-cap__steps {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 2px 0 12px;
	padding: 9px 13px;
	border-radius: 12px;
	background: #faf7ff;
	border: 1px solid #ece4fd;
}

.earn-cap .earn-cap__steps-label {
	font-size: 13.5px;
	font-weight: 800;
	color: #6d28d9;
	letter-spacing: -.005em;
}

.earn-cap__dots { display: inline-flex; gap: 7px; }

.earn-cap__dot {
	display: block;
	width: 28px;
	height: 8px;
	border-radius: 999px;
	background: #e7def9;
	transition: background .35s, transform .35s;
}

.earn-cap__dot.is-current { background: #c4b5fd; }
.earn-cap__dot.is-done { background: linear-gradient(90deg, #10b981, #34d399); }

/* A solved code pops its dot. */
.earn-cap.is-step .earn-cap__dot.is-done:last-of-type,
.earn-cap.is-step .earn-cap__dot.is-done { animation: capDot .5s cubic-bezier(.2, .9, .3, 1.4); }

@keyframes capDot {
	0% { transform: scaleX(.4); }
	60% { transform: scaleX(1.15); }
	100% { transform: scaleX(1); }
}

.earn-cap .earn-cap__msg--success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

@media ( prefers-reduced-motion: reduce ) {
	.earn-cap.is-step .earn-cap__dot.is-done { animation: none; }
	.earn-cap__dot { transition: none; }
}

/* Daily-limit state: amber instead of green, pause glyph instead of a tick. */
.earn-cap__ico-limit { display: none; }
.earn-cap.is-limit .earn-cap__ico-done { display: none; }
.earn-cap.is-limit .earn-cap__ico-limit { display: block; }
.earn-cap.is-limit .earn-cap__done { background: linear-gradient(135deg, #fffbeb, #fff7ed); border-color: #fde68a; }
.earn-cap.is-limit .earn-cap__check { background: linear-gradient(135deg, #d97706, #f59e0b); box-shadow: 0 10px 22px -10px rgba(217, 119, 6, .9); }
.earn-cap.is-limit .earn-cap__done b { color: #b45309; }
.earn-cap.is-limit .earn-cap__recharge { background: #fef3c7; }
.earn-cap.is-limit .earn-cap__recharge-fill { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.earn-cap.is-limit .earn-cap__recharge-pct { color: #b45309; }

/* "Charging complete after 24h" under the recharge bar */
.earn-cap .earn-cap__recharge-note {
	display: flex; align-items: center; gap: 6px; margin-top: 7px;
	font-size: 12.5px; font-weight: 700; color: #047857;
}
.earn-cap .earn-cap__recharge-note::before {
	content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .7;
}
.earn-cap.is-limit .earn-cap__recharge-note { color: #b45309; }
