/**
 * Wise Moe Wheel — frontend styles.
 * Brand: ink #111211, gold #FAC630, violet #6E4F9A, green #6C8F34, red #DE433D, cream #FEFAF3.
 */
.wmwb-wheel {
	--wmwb-ink: #111211;
	--wmwb-gold: #FAC630;
	--wmwb-violet: #6E4F9A;
	--wmwb-green: #6C8F34;
	--wmwb-red: #DE433D;
	--wmwb-cream: #FEFAF3;
	--wmwb-max: 560px;
	--wmwb-radius: 20px;

	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: clamp(16px, 3vw, 40px);
	align-items: start;
	max-width: 1100px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
	color: var(--wmwb-ink);
	transition: grid-template-columns .45s cubic-bezier(.22,.61,.36,1);
}

/* Collapsed: the side panel folds away and the wheel takes the space smoothly. */
.wmwb-wheel.is-collapsed {
	grid-template-columns: minmax(0, 1fr) 0px;
}
.wmwb-wheel.is-collapsed .wmwb-wheel__side {
	opacity: 0;
	transform: translateX(12px);
	pointer-events: none;
}

.wmwb-wheel__stage {
	display: flex;
	justify-content: center;
	align-items: flex-start;
}

.wmwb-wheel__canvas-wrap {
	position: relative;
	width: 100%;
	max-width: var(--wmwb-max);
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: max-width .45s cubic-bezier(.22,.61,.36,1);
}
.wmwb-wheel.is-collapsed .wmwb-wheel__canvas-wrap { max-width: 760px; }

.wmwb-wheel__canvas-wrap canvas {
	display: block;
	width: 100%;
	height: auto;
	filter: drop-shadow(0 18px 40px rgba(17, 18, 17, 0.22));
	transition: filter .2s ease;
}
.wmwb-wheel.is-spinning .wmwb-wheel__canvas-wrap canvas {
	filter: drop-shadow(0 22px 52px rgba(110, 79, 154, 0.32));
}

/* Collapse / expand handle (SVG chevron), sits between wheel and panel. */
.wmwb-wheel__collapse {
	position: absolute;
	top: 12px;
	right: 0;
	z-index: 6;
	width: 34px;
	height: 34px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	border: 1.5px solid rgba(17,18,17,0.12);
	background: #fff;
	color: var(--wmwb-ink);
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(17,18,17,0.12);
	transition: transform .45s cubic-bezier(.22,.61,.36,1), background .15s ease;
}
.wmwb-wheel__collapse:hover { background: var(--wmwb-gold); }
.wmwb-wheel.is-collapsed .wmwb-wheel__collapse { transform: rotate(180deg); }

/* Center spin button */
.wmwb-wheel__spin {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 22%;
	height: 22%;
	min-width: 64px;
	min-height: 64px;
	border-radius: 50%;
	border: 4px solid var(--wmwb-ink);
	background: var(--wmwb-gold);
	color: var(--wmwb-ink);
	font-weight: 800;
	font-size: clamp(12px, 2.2vw, 18px);
	letter-spacing: .06em;
	cursor: pointer;
	box-shadow: 0 6px 0 rgba(17, 18, 17, 0.85), 0 10px 24px rgba(17, 18, 17, 0.28);
	transition: transform .08s ease, box-shadow .08s ease;
	z-index: 3;
}
.wmwb-wheel__spin:hover { transform: translate(-50%, -52%); }
.wmwb-wheel__spin:active { transform: translate(-50%, -48%); box-shadow: 0 3px 0 rgba(17,18,17,0.85), 0 6px 14px rgba(17,18,17,0.28); }
.wmwb-wheel.is-spinning .wmwb-wheel__spin { pointer-events: none; opacity: .9; }

.wmwb-wheel__spin [data-role="spin-label"] {
	display: block;
	padding: 0 4px;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* When it holds the winner, the centre button becomes a result badge. */
.wmwb-wheel__spin.is-result {
	background: var(--wmwb-green) !important;
	color: #fff !important;
	font-size: clamp(11px, 1.8vw, 15px);
	animation: wmwb-result-pop .5s cubic-bezier(.2,.9,.3,1.4);
	width: 26%;
	height: 26%;
}
@keyframes wmwb-result-pop { 0% { transform: translate(-50%,-50%) scale(.7); } 60% { transform: translate(-50%,-50%) scale(1.12); } 100% { transform: translate(-50%,-50%) scale(1); } }

/* Pointer at the top */
.wmwb-wheel__pointer {
	position: absolute;
	top: -2%;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 0;
	border-left: 16px solid transparent;
	border-right: 16px solid transparent;
	border-top: 30px solid var(--wmwb-red);
	filter: drop-shadow(0 3px 4px rgba(17, 18, 17, 0.35));
	z-index: 4;
}

/* Side panel */
.wmwb-wheel__side {
	background: var(--wmwb-cream);
	border: 2px solid rgba(17, 18, 17, 0.08);
	border-radius: var(--wmwb-radius);
	padding: clamp(16px, 2.4vw, 24px);
	box-shadow: 0 10px 30px rgba(17, 18, 17, 0.08);
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-width: 0;
	max-height: 78vh;
	overflow-y: auto;
	transition: opacity .35s ease, transform .35s ease;
}

.wmwb-wheel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
.wmwb-wheel__title {
	margin: 0;
	font-size: clamp(18px, 2.6vw, 24px);
	font-weight: 800;
	line-height: 1.15;
}
.wmwb-wheel__tools { display: flex; gap: 6px; flex-shrink: 0; }

.wmwb-icon-btn {
	width: 36px; height: 36px;
	display: grid; place-items: center;
	border-radius: 10px;
	border: 1.5px solid rgba(17,18,17,0.12);
	background: #fff;
	cursor: pointer;
	font-size: 16px;
	transition: background .15s ease, transform .1s ease;
}
.wmwb-icon-btn:hover { background: var(--wmwb-gold); transform: translateY(-1px); }

.wmwb-wheel__list {
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-height: 260px;
	overflow-y: auto;
	padding-right: 4px;
}
.wmwb-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 10px;
	background: #fff;
	border: 1.5px solid rgba(17, 18, 17, 0.06);
}
.wmwb-item.is-off { opacity: .45; }
.wmwb-item__dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.wmwb-item__label { flex: 1; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wmwb-item__del {
	border: none; background: transparent; cursor: pointer;
	font-size: 18px; line-height: 1; color: var(--wmwb-red);
	width: 24px; height: 24px; border-radius: 6px;
}
.wmwb-item__del:hover { background: rgba(222, 67, 61, 0.12); }
.wmwb-item__edit {
	flex: 1; min-width: 0;
	border: 1px solid transparent;
	background: transparent;
	font-size: 14px; font-weight: 600;
	padding: 3px 6px; border-radius: 7px;
	color: var(--wmwb-ink);
}
.wmwb-item__edit:hover { border-color: rgba(17,18,17,0.12); background: #fff; }
.wmwb-item__edit:focus { outline: none; border-color: var(--wmwb-violet); background: #fff; }
.wmwb-item__color {
	width: 24px; height: 24px; padding: 0;
	border: 1.5px solid rgba(17,18,17,0.12);
	border-radius: 6px; cursor: pointer; flex-shrink: 0;
	background: none;
}
.wmwb-empty { color: rgba(17,18,17,0.5); font-size: 14px; margin: 4px 0; }

/* Sound panel */
.wmwb-wheel__sound {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	background: #fff;
	border: 1.5px solid rgba(17, 18, 17, 0.06);
	border-radius: 12px;
}
.wmwb-sound__icon { font-size: 16px; flex-shrink: 0; }
.wmwb-wheel__sound input[type="range"] {
	flex: 1; min-width: 0;
	accent-color: var(--wmwb-violet);
	cursor: pointer;
}

.wmwb-wheel__controls { display: flex; flex-direction: column; gap: 10px; }
.wmwb-add-row { display: flex; gap: 8px; }
.wmwb-add-row input {
	flex: 1; min-width: 0;
	padding: 10px 12px;
	border-radius: 10px;
	border: 1.5px solid rgba(17, 18, 17, 0.16);
	font-size: 14px;
	background: #fff;
}
.wmwb-add-row input:focus { outline: 2px solid var(--wmwb-violet); outline-offset: 1px; }
.wmwb-control-row { display: flex; gap: 8px; flex-wrap: wrap; }

.wmwb-btn {
	appearance: none;
	border: 2px solid var(--wmwb-ink);
	background: var(--wmwb-gold);
	color: var(--wmwb-ink);
	font-weight: 700;
	font-size: 14px;
	padding: 9px 16px;
	border-radius: 10px;
	cursor: pointer;
	transition: transform .08s ease, background .15s ease;
}
.wmwb-btn:hover { transform: translateY(-1px); }
.wmwb-btn--ghost { background: #fff; }
.wmwb-btn--ghost:hover { background: var(--wmwb-cream); }

/* Winner modal */
.wmwb-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: grid;
	place-items: center;
	padding: 20px;
	background: rgba(17, 18, 17, 0.55);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	animation: wmwb-fade .2s ease;
}
.wmwb-modal__box {
	position: relative;
	background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(254,250,243,0.96));
	border: 2px solid rgba(17,18,17,0.1);
	border-radius: 24px;
	padding: 30px 28px 24px;
	max-width: 420px;
	width: 100%;
	text-align: center;
	box-shadow: 0 30px 80px rgba(17, 18, 17, 0.4);
	animation: wmwb-pop .35s cubic-bezier(.2,.9,.3,1.4);
}
.wmwb-modal__eyebrow {
	font-size: 13px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: .14em;
	color: var(--wmwb-violet);
}
.wmwb-modal__label {
	font-size: clamp(26px, 6vw, 40px);
	font-weight: 900;
	line-height: 1.1;
	margin: 10px 0 18px;
	color: var(--wmwb-ink);
	word-break: break-word;
}
.wmwb-modal__img img, .wmwb-modal__mascot {
	max-width: 120px; max-height: 120px; border-radius: 16px; margin: 10px auto 0; display: block;
}
.wmwb-modal__mascot { position: absolute; top: -46px; right: -10px; width: 92px; height: auto; }
.wmwb-modal__actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* Winners history */
.wmwb-wheel__history {
	border-top: 1.5px solid rgba(17, 18, 17, 0.08);
	padding-top: 12px;
	margin-top: 2px;
}
.wmwb-history__head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
}
.wmwb-history__head h4 { margin: 0; font-size: 14px; font-weight: 800; flex-shrink: 0; }
.wmwb-history__total { color: rgba(17,18,17,0.5); font-size: 12px; margin-inline-start: auto; }
.wmwb-history__list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.wmwb-hist-row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	border-radius: 8px;
	background: #fff;
	border: 1.5px solid rgba(17, 18, 17, 0.06);
}
.wmwb-hist-thumb { width: 22px; height: 22px; border-radius: 5px; object-fit: cover; }
.wmwb-hist-label { flex: 1; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wmwb-hist-count {
	font-weight: 800;
	font-size: 13px;
	color: var(--wmwb-violet);
	background: rgba(110, 79, 154, 0.12);
	padding: 2px 9px;
	border-radius: 999px;
}

.wmwb-add-row .wmwb-icon-btn { flex-shrink: 0; }

.wmwb-confetti {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	pointer-events: none;
	z-index: 100000; /* above the winner popup (99999) */
}

.wmwb-inline-notice {
	background: rgba(222, 67, 61, 0.1);
	border: 1px solid rgba(222, 67, 61, 0.4);
	color: #8a2a26;
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 14px;
}

@keyframes wmwb-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes wmwb-pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Responsive: stack on small screens */
@media (max-width: 720px) {
	.wmwb-wheel,
	.wmwb-wheel.is-collapsed {
		grid-template-columns: 1fr;
	}
	.wmwb-wheel__side { order: 2; }
	.wmwb-wheel__stage { order: 1; }
	.wmwb-wheel__list { max-height: 200px; }
	.wmwb-wheel__collapse { display: none; }
	.wmwb-wheel.is-collapsed .wmwb-wheel__side { opacity: 1; transform: none; pointer-events: auto; }
	.wmwb-wheel.is-collapsed .wmwb-wheel__canvas-wrap { max-width: var(--wmwb-max); }
}

@media (prefers-reduced-motion: reduce) {
	.wmwb-wheel__canvas-wrap canvas,
	.wmwb-wheel__spin { transition: none; }
	.wmwb-modal, .wmwb-modal__box { animation: none; }
}

/* Shared standalone page */
.wmwb-share-page {
	margin: 0;
	min-height: 100vh;
	background: radial-gradient(1200px 600px at 50% -10%, rgba(110,79,154,0.15), transparent), var(--wmwb-cream, #FEFAF3);
}
.wmwb-share-main {
	max-width: 1040px;
	margin: 0 auto;
	padding: 32px 20px 60px;
}
.wmwb-share-home {
	display: inline-block;
	font-weight: 800;
	text-decoration: none;
	color: #111211;
	margin-bottom: 24px;
	font-size: 18px;
}
.wmwb-share-expired {
	text-align: center;
	max-width: 460px;
	margin: 8vh auto;
	background: #fff;
	border-radius: 24px;
	padding: 40px 28px;
	box-shadow: 0 20px 60px rgba(17,18,17,0.12);
}
.wmwb-share-expired__emoji { font-size: 48px; }
.wmwb-wheel--shared { margin-top: 10px; }
