:root {
	--candy-gold: #e7b950;
	--candy-deep: #4c160f;
	--candy-red: #9b2d20;
	--candy-cream: #fff0bd;
	--candy-chapter-art: url("assets/campaign-v1/chapter-01-dawn.png");
}

html,
body {
	width: 100%;
	height: 100%;
	min-height: 100%;
	overflow: hidden;
	overscroll-behavior: none;
	overscroll-behavior-x: none;
	background:
		linear-gradient(rgba(27, 7, 5, 0.72), rgba(27, 7, 5, 0.84)),
		url("images/background-sheet0.png") center / cover fixed !important;
}

.ios-back-gesture-guard {
	display: none;
}

html.ios-touch-device body:not(.candy-on-home) .ios-back-gesture-guard {
	display: block;
	position: fixed;
	z-index: 2147483000;
	left: 0;
	top: 0;
	bottom: 0;
	width: max(24px, env(safe-area-inset-left));
	touch-action: none;
	overscroll-behavior: none;
	background: transparent;
}

body {
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

#c2canvasdiv {
	position: relative !important;
	margin: 0 !important;
	width: min(100vw, calc(100dvh * 5 / 9)) !important;
	height: 100vh !important;
	height: 100dvh !important;
	overflow: hidden;
	/* 游戏背景由 Construct 画布绘制；容器不再叠加第二张背景图。 */
	background: #2c0c08;
	box-shadow: 0 0 55px rgba(0, 0, 0, 0.72);
	/* touch-action: none 防止触屏竖向拖拽连线时浏览器启动滚动手势吞掉
	   touchmove/pointermove，导致竖向连不上（横向因容器撑满视口不受影响，
	   这正是"横向能连、竖向连不上"的不对称根因）。用 !important 防止被覆盖。 */
	touch-action: none !important;
}

#c2canvas {
	position: absolute !important;
	inset: 0 !important;
	top: 0 !important;
	width: 100% !important;
	height: 100% !important;
	aspect-ratio: auto !important;
	transform: none !important;
	object-fit: fill;
	touch-action: none !important;
}

#candy-link-overlay {
	position: absolute;
	z-index: 30;
	inset: 0;
	top: 0;
	width: 100%;
	height: 100%;
	aspect-ratio: auto;
	transform: none;
	pointer-events: none;
}

.candy-game-control {
	position: absolute;
	z-index: 45;
	bottom: 6.2%;
	width: clamp(50px, 13.5%, 62px);
	aspect-ratio: 59 / 64;
	border: 2px solid #f1c765;
	border-radius: 50%;
	color: #fff0bd;
	background:
		radial-gradient(circle at 50% 32%, #b4432d 0 28%, #7c2119 66%, #42100c 100%);
	box-shadow:
		inset 0 0 0 3px rgba(91, 26, 17, 0.76),
		inset 0 2px 0 rgba(255, 239, 168, 0.48),
		0 4px 0 #3e100c,
		0 7px 15px rgba(0, 0, 0, 0.38);
	font: 900 clamp(13px, 3.4vw, 17px) "STKaiti", "KaiTi", "Microsoft YaHei", sans-serif;
	letter-spacing: 0.04em;
	cursor: pointer;
	transition: transform 120ms ease, filter 120ms ease;
}

.candy-game-back {
	right: 3.2%;
}

.candy-game-settings {
	top: 6.2%;
	bottom: auto;
	left: 3.2%;
}

.candy-game-tutorial {
	top: 6.2%;
	bottom: auto;
	right: 3.2%;
}

/* 使用游戏自身的同款圆形按钮；通用教程入口仅保留为弹窗触发器。 */
body > .game-tutorial-trigger {
	display: none !important;
}

.candy-game-pause {
	left: 3.2%;
}

.candy-game-pause.is-paused {
	background:
		radial-gradient(circle at 50% 32%, #9d6a28 0 28%, #6f3517 66%, #35150b 100%);
}

.candy-game-control:active {
	transform: translateY(3px) scale(0.96);
	filter: brightness(1.18);
	box-shadow:
		inset 0 0 0 3px rgba(91, 26, 17, 0.76),
		inset 0 2px 0 rgba(255, 239, 168, 0.48),
		0 1px 0 #3e100c;
}

body.candy-on-home .candy-game-control {
	display: none;
}

.candy-powerups {
	left: 50%;
	bottom: 11.8%;
	gap: 30px !important;
	transform: translateX(-50%);
}

.candy-powerups .imperial-powerup-button {
	min-width: clamp(112px, 29vw, 132px);
}

.candy-powerups .imperial-powerup-button b {
	top: 2px;
	right: -23px;
	z-index: 3;
	box-sizing: border-box;
	width: 22px;
	min-width: 22px;
	height: 22px;
	padding: 0;
}

body.candy-on-home .candy-powerups {
	display: none;
}

.candy-pause-overlay {
	position: absolute;
	z-index: 43;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	color: #fff0bd;
	background: rgba(31, 7, 6, 0.64);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	pointer-events: none;
}

.candy-pause-overlay.is-hidden {
	display: none;
}

.candy-pause-overlay strong {
	padding: 10px 28px;
	border: 2px solid #e9b84f;
	border-radius: 999px;
	background: linear-gradient(#9c3426, #621912);
	box-shadow: 0 5px 0 #35100c;
	font: 900 clamp(24px, 7vw, 34px) "STKaiti", "KaiTi", "Microsoft YaHei", sans-serif;
	letter-spacing: 0.12em;
}

.candy-pause-overlay span {
	font-size: clamp(13px, 3.5vw, 16px);
	font-weight: 700;
}

.candy-game-hud {
	position: absolute;
	z-index: 44;
	left: 50%;
	bottom: 5.4%;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: clamp(9px, 2.6vw, 16px);
	width: 58%;
	min-height: clamp(40px, 10.8vw, 48px);
	padding: 0 4%;
	box-sizing: border-box;
	border: 2px solid #e9b84f;
	border-radius: 999px;
	color: #ffe9ad;
	background: linear-gradient(180deg, rgba(112, 32, 23, 0.96), rgba(64, 15, 12, 0.97));
	box-shadow:
		inset 0 2px 0 rgba(255, 235, 158, 0.28),
		0 4px 0 rgba(48, 10, 8, 0.9),
		0 7px 16px rgba(0, 0, 0, 0.35);
	transform: translateX(-50%);
	font: 800 clamp(14px, 3.6vw, 18px) "Microsoft YaHei", "Noto Sans SC", sans-serif;
	white-space: nowrap;
}

.candy-game-hud span {
	display: inline-flex;
	align-items: baseline;
	gap: 5px;
}

.candy-game-hud strong {
	color: #fff6cf;
	font-size: 1.16em;
	font-variant-numeric: tabular-nums;
}

.candy-game-hud em {
	color: #e9c982;
	font-size: 0.86em;
	font-style: normal;
}

.candy-game-hud i {
	width: 1px;
	height: 1.45em;
	background: rgba(235, 184, 79, 0.52);
}

.candy-level-progress {
	position: absolute;
	z-index: 44;
	left: 50%;
	/* 棋盘在 Construct 坐标中结束于 y=628/800；进度条从棋盘下方开始。 */
	top: calc(78.5% + 10px);
	bottom: auto;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 8px;
	width: 74%;
	padding: 4px 9px;
	border: 1px solid rgba(232, 180, 72, .72);
	border-radius: 999px;
	color: #f8dc91;
	background: rgba(70, 15, 11, .9);
	box-shadow: 0 3px 10px rgba(0, 0, 0, .34);
	font: 800 clamp(10px, 2.8vw, 12px)/1 "Microsoft YaHei", sans-serif;
	transform: translateX(-50%);
}

.candy-level-progress-track {
	height: 7px;
	overflow: hidden;
	border: 1px solid #d99a37;
	border-radius: 999px;
	background: rgba(30, 6, 4, .86);
}

.candy-level-progress-track i {
	display: block;
	width: 0;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, #b73424, #ed9c37 72%, #ffe387);
	box-shadow: 0 0 7px rgba(255, 190, 67, .72);
	transition: width .2s ease;
}

.candy-level-progress.is-complete .candy-level-progress-track i {
	background: linear-gradient(90deg, #5d9e55, #bfdf70, #fff0a1);
}

body.candy-on-home .candy-game-hud {
	display: none;
}

body.candy-on-home .candy-level-progress { display: none; }

#c2canvasdiv.is-shuffling #c2canvas {
	animation: candy-board-shuffle 0.58s ease;
}

#c2canvasdiv.is-merging-food #c2canvas {
	animation: candy-board-merge 0.58s ease;
}

#c2canvasdiv.is-grand-match::after {
	content: "";
	position: absolute;
	z-index: 840;
	inset: 0;
	pointer-events: none;
	background: radial-gradient(circle at 50% 48%, rgba(255, 248, 190, .62), rgba(255, 188, 48, .22) 38%, transparent 72%);
	animation: candy-grand-flash .72s ease-out both;
}

.candy-match-fx {
	position: absolute;
	z-index: 850;
	width: 0;
	height: 0;
	pointer-events: none;
}

.candy-match-fx .match-core,
.candy-match-fx .match-ring,
.candy-match-fx .match-spark,
.candy-match-fx strong {
	position: absolute;
	left: 0;
	top: 0;
}

.candy-match-fx .match-core {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: radial-gradient(circle, #fffbd6 0 18%, #ffd85b 32%, rgba(255, 154, 33, .42) 62%, transparent 73%);
	box-shadow: 0 0 18px #ffe270, 0 0 36px rgba(255, 140, 27, .9);
	transform: translate(-50%, -50%);
	animation: candy-match-core .72s ease-out both;
}

.candy-match-fx .match-ring {
	width: 68px;
	height: 68px;
	border: 4px solid rgba(255, 224, 103, .92);
	border-radius: 50%;
	box-shadow: 0 0 14px rgba(255, 190, 49, .88), inset 0 0 12px rgba(255, 242, 177, .62);
	transform: translate(-50%, -50%) scale(.2);
	animation: candy-match-ring .78s ease-out both;
}

.candy-match-fx .ring-two {
	width: 94px;
	height: 94px;
	border-style: double;
	animation-delay: 90ms;
}

.candy-match-fx .match-spark {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #fff4a9;
	box-shadow: 0 0 8px #ffd75d, 0 0 13px #ff8f2d;
	transform: translate(-50%, -50%);
	animation: candy-match-spark .76s var(--spark-delay) cubic-bezier(.12, .72, .2, 1) both;
}

.candy-match-fx .match-spark.is-star {
	width: 13px;
	height: 13px;
	border-radius: 2px;
	transform: translate(-50%, -50%) rotate(45deg);
}

.candy-match-fx strong {
	min-width: 132px;
	text-align: center;
	color: #fff2a8;
	font: 900 21px/1.05 "STKaiti", "KaiTi", "Microsoft YaHei", serif;
	letter-spacing: .08em;
	text-shadow: 0 2px 0 #7a2014, 0 0 10px #ffbd3d, 0 0 20px #f06b22;
	transform: translate(-50%, -155%) scale(.7);
	animation: candy-match-label .95s ease-out both;
}

.candy-match-fx strong small {
	display: block;
	margin-top: 5px;
	font: 900 14px/1 "Microsoft YaHei", sans-serif;
	letter-spacing: 0;
}

.candy-match-fx.tier-2 { filter: saturate(1.14); }
.candy-match-fx.tier-2 strong { font-size: 25px; }
.candy-match-fx.tier-3 { filter: saturate(1.28) brightness(1.08); }
.candy-match-fx.tier-3 strong { min-width: 180px; font-size: 30px; }
.candy-match-fx.tier-4 { filter: saturate(1.45) brightness(1.16); }
.candy-match-fx.tier-4 strong { min-width: 210px; font-size: 36px; }
.candy-match-fx.tier-4 .match-core { width: 58px; height: 58px; }
.candy-match-fx.tier-4 .match-ring { width: 126px; height: 126px; border-width: 6px; }
.candy-match-fx.tier-4 .ring-two { width: 172px; height: 172px; }

.candy-home {
	position: absolute;
	z-index: 1000;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 7.5% 7% max(4%, env(safe-area-inset-bottom));
	box-sizing: border-box;
	color: var(--candy-cream);
	background:
		linear-gradient(rgba(47, 11, 8, 0.24), rgba(38, 8, 6, 0.82)),
		var(--candy-chapter-art) center / cover no-repeat;
	transition: opacity 0.24s ease, visibility 0.24s ease;
}

.candy-home::before {
	content: "";
	position: absolute;
	inset: 1.6%;
	border: 2px solid rgba(231, 185, 80, 0.7);
	border-radius: 24px;
	box-shadow: inset 0 0 0 4px rgba(87, 22, 14, 0.44);
	pointer-events: none;
}

.candy-home.is-hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.candy-home-kicker {
	margin-top: 1%;
	color: #f4d98d;
	font-family: "STKaiti", "KaiTi", serif;
	font-size: clamp(13px, 3.2vw, 18px);
	font-weight: 800;
	letter-spacing: 0.42em;
}

.candy-home-title {
	margin: 2% 0 0;
	text-align: center;
	color: #fff1b7;
	text-shadow: 0 3px 0 #5b170f, 0 0 16px rgba(255, 205, 86, 0.46);
	font-family: "STKaiti", "KaiTi", serif;
	font-size: clamp(38px, 10.5vw, 60px);
	line-height: 1.05;
	letter-spacing: 0.1em;
}

.candy-home-subtitle {
	margin-top: 2%;
	padding: 4px 18px;
	border-top: 1px solid rgba(232, 190, 93, 0.62);
	border-bottom: 1px solid rgba(232, 190, 93, 0.62);
	color: #f0cf83;
	font-size: clamp(11px, 2.8vw, 15px);
	letter-spacing: 0.16em;
}

.candy-level-summary {
	position: relative;
	z-index: 1;
	display: grid;
	grid-template-columns: 38px minmax(0, 1fr) 38px;
	gap: 7px;
	width: min(92%, 410px);
	margin-top: 3.2%;
}

.candy-level-summary > button {
	min-width: 0;
	border: 1.5px solid rgba(239, 197, 95, 0.86);
	border-radius: 14px;
	color: #ffeab0;
	background: linear-gradient(rgba(121, 34, 23, 0.94), rgba(67, 15, 11, 0.96));
	box-shadow: inset 0 1px rgba(255, 238, 174, 0.28), 0 3px 8px rgba(22, 4, 3, 0.42);
	cursor: pointer;
}

.candy-level-summary > button:not(.candy-level-main) {
	font: 900 28px/1 "STKaiti", "KaiTi", serif;
}

.candy-level-summary > button:disabled {
	opacity: 0.34;
	cursor: default;
}

.candy-level-main {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 52px;
	padding: 5px 8px;
}

.candy-level-main strong {
	font: 900 clamp(16px, 4vw, 21px) "STKaiti", "KaiTi", serif;
	letter-spacing: 0.06em;
}

.candy-level-main span {
	margin-top: 2px;
	color: #e9c982;
	font-size: clamp(9px, 2.25vw, 12px);
	white-space: nowrap;
}

.candy-food-plate {
	position: relative;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	grid-template-rows: repeat(2, minmax(0, 1fr));
	align-items: center;
	justify-items: center;
	width: min(76%, 330px);
	aspect-ratio: 1.65;
	margin-top: 3.5%;
	padding: 5% 8% 4%;
	border: 3px solid #dfaa45;
	border-radius: 50%;
	background:
		radial-gradient(ellipse, rgba(255, 239, 180, 0.96) 0 54%, rgba(176, 82, 35, 0.96) 56% 65%, rgba(81, 21, 13, 0.96) 67%);
	box-shadow: 0 13px 22px rgba(26, 5, 3, 0.5), inset 0 0 22px rgba(109, 35, 17, 0.34);
}

.candy-food-token {
	position: relative;
	width: clamp(52px, 13.5vw, 72px);
	aspect-ratio: 1;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	filter: drop-shadow(0 7px 4px rgba(61, 18, 10, 0.38));
	animation: candy-token-float 1.8s ease-in-out infinite alternate;
}

.candy-food-token.one { top: 10%; background-image: url("images/pastries/flower.png"); }
.candy-food-token.two { top: -9%; background-image: url("images/pastries/sesame.png"); animation-delay: -0.7s; }
.candy-food-token.three { top: 10%; background-image: url("images/pastries/rose.png"); animation-delay: -1.2s; }
.candy-food-token.four { top: -8%; background-image: url("images/pastries/purple.png"); animation-delay: -0.35s; }
.candy-food-token.five { top: 3%; background-image: url("images/pastries/shou.png"); animation-delay: -1.45s; }
.candy-food-token.six { top: -8%; background-image: url("images/pastries/purple-active.png"); animation-delay: -0.95s; }

.candy-home-copy {
	width: min(90%, 390px);
	margin-top: 4%;
	padding: 13px 17px;
	border: 1px solid rgba(235, 190, 91, 0.58);
	border-radius: 15px;
	text-align: center;
	background: rgba(72, 19, 12, 0.82);
	box-shadow: inset 0 0 18px rgba(255, 210, 102, 0.08);
}

.candy-home-copy strong {
	display: block;
	margin-bottom: 5px;
	color: #ffe8a5;
	font-family: "STKaiti", "KaiTi", serif;
	font-size: clamp(18px, 4.6vw, 25px);
	letter-spacing: 0.1em;
}

.candy-home-copy span {
	color: #edcf91;
	font-size: clamp(11px, 2.8vw, 14px);
	line-height: 1.55;
}

.candy-home-actions {
	width: min(88%, 380px);
	margin-top: auto;
}

.candy-home-button,
.candy-settings-button {
	border: 2px solid #efc55f;
	color: #fff0b6;
	background: linear-gradient(#b83d2b, #7c2118);
	box-shadow: inset 0 2px rgba(255, 236, 162, 0.34), 0 5px 0 #4a130e;
	font-family: "STKaiti", "KaiTi", "Microsoft YaHei", serif;
	font-weight: 900;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.candy-home-button:active,
.candy-settings-button:active {
	transform: translateY(4px) scale(0.98);
	box-shadow: inset 0 2px rgba(255, 236, 162, 0.34), 0 1px 0 #4a130e;
}

.candy-home-start {
	width: min(82%, 380px);
	margin-top: 4%;
	padding: 13px 20px;
	border-radius: 999px;
	font-size: clamp(22px, 5.5vw, 30px);
	letter-spacing: 0.18em;
}

.candy-level-mask {
	position: fixed;
	z-index: 2147483646;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(27, 6, 4, 0.84);
	backdrop-filter: blur(8px);
}

.candy-level-mask.is-hidden {
	display: none;
}

.candy-level-panel {
	width: min(430px, 94vw);
	max-height: min(760px, 88dvh);
	padding: 16px;
	box-sizing: border-box;
	border: 2px solid #e6b64e;
	border-radius: 22px;
	background:
		linear-gradient(rgba(76, 18, 12, 0.82), rgba(48, 10, 8, 0.96)),
		var(--candy-chapter-art) center / cover no-repeat;
	box-shadow: inset 0 0 0 4px rgba(69, 15, 10, 0.8), 0 18px 48px rgba(0, 0, 0, 0.58);
	overflow: auto;
}

.candy-level-panel header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
	color: #ffe8a6;
}

.candy-level-panel header small {
	color: #dfbb6d;
	letter-spacing: 0.22em;
}

.candy-level-panel h2 {
	margin: 2px 0 0;
	font: 900 30px/1.1 "STKaiti", "KaiTi", serif;
}

.candy-level-panel header button {
	padding: 8px 15px;
	border: 1.5px solid #e9ba51;
	border-radius: 999px;
	color: #ffe9ad;
	background: #8b291e;
	font-weight: 800;
}

.candy-level-grid {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 8px;
}

.candy-level-cell {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 58px;
	border: 1px solid rgba(232, 187, 82, 0.72);
	border-radius: 12px;
	color: #ffe9aa;
	background: linear-gradient(#8e2b20, #57150f);
	box-shadow: inset 0 1px rgba(255, 238, 174, 0.24), 0 3px 0 rgba(47, 9, 7, 0.86);
}

.candy-level-cell b {
	font-size: 20px;
}

.candy-level-cell small {
	margin-top: 2px;
	font-size: 9px;
	opacity: 0.82;
}

.candy-level-cell.is-current {
	outline: 3px solid #fff0a7;
	filter: brightness(1.22);
}

.candy-level-cell.is-complete::after {
	content: "通";
	position: absolute;
	top: -5px;
	right: -4px;
	display: grid;
	place-items: center;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	color: #fff2bd;
	background: #b83a26;
	font-size: 10px;
	font-weight: 900;
}

.candy-level-cell:disabled {
	color: #8d745f;
	background: rgba(46, 31, 27, 0.82);
	box-shadow: none;
}

.candy-home-secondary {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 9px;
	margin-top: 15px;
}

.candy-on-home > .game-tutorial-trigger {
	display: none !important;
}

.candy-home-secondary .candy-home-button {
	padding: 10px 12px;
	border-radius: 999px;
	font-size: clamp(15px, 3.8vw, 20px);
}

.candy-settings-mask {
	position: fixed;
	z-index: 2147483645;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px;
	background: rgba(29, 7, 5, 0.78);
	backdrop-filter: blur(8px);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: 0.2s ease;
}

.candy-settings-mask.is-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.candy-settings-panel {
	width: min(82vw, 370px);
	padding: 25px 23px 22px;
	border: 3px solid var(--candy-gold);
	border-radius: 23px;
	color: #542016;
	background: linear-gradient(#fff2c5, #eecf8c);
	box-shadow: 0 20px 55px rgba(0, 0, 0, 0.52), inset 0 0 0 5px rgba(125, 42, 24, 0.12);
}

.candy-settings-panel h2 {
	margin: 0 0 20px;
	text-align: center;
	color: #8b2b20;
	font-family: "STKaiti", "KaiTi", serif;
	font-size: 28px;
	letter-spacing: 0.12em;
}

.candy-settings-row label {
	display: flex;
	justify-content: space-between;
	font-weight: 900;
}

.candy-settings-row input {
	width: 100%;
	margin: 11px 0 17px;
	accent-color: #a32f21;
	touch-action: none;
	cursor: pointer;
}

.candy-settings-row + .candy-settings-row {
	margin-top: 2px;
}

.candy-settings-row.is-disabled {
	opacity: 0.4;
	pointer-events: none;
}

.candy-settings-actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

#candy-time-feedback {
	position: absolute;
	z-index: 900;
	left: 50%;
	top: 17%;
	padding: 8px 18px;
	border: 2px solid #f2ca67;
	border-radius: 999px;
	color: #fff0ad;
	background: rgba(132, 38, 25, 0.94);
	box-shadow: 0 5px 13px rgba(42, 8, 5, 0.46);
	font-weight: 900;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, 12px);
}

#candy-time-feedback.is-visible {
	animation: candy-time-bonus 0.9s ease forwards;
}

.candy-settings-button {
	padding: 10px 8px;
	border-radius: 12px;
	font-size: 16px;
}

@keyframes candy-token-float {
	to { transform: translateY(-7px) rotate(3deg); }
}

@keyframes candy-time-bonus {
	15%, 70% { opacity: 1; transform: translate(-50%, 0); }
	100% { opacity: 0; transform: translate(-50%, -24px); }
}

@keyframes candy-board-shuffle {
	0%, 100% {
		transform: translateY(-50%);
		filter: brightness(1) saturate(1);
	}
	35% {
		transform: translateY(-50%);
		filter: brightness(1.16) saturate(1.12);
	}
	70% {
		transform: translateY(-50%);
		filter: brightness(0.96) saturate(1.04);
	}
}

@keyframes candy-board-merge {
	0%, 100% {
		transform: translateY(-50%);
		filter: brightness(1) saturate(1);
	}
	45% {
		transform: translateY(-50%);
		filter: brightness(1.24) saturate(1.3) drop-shadow(0 0 10px rgba(255, 211, 88, .72));
	}
}

@keyframes candy-match-core {
	0% { opacity: 0; transform: translate(-50%, -50%) scale(.15); }
	42% { opacity: 1; transform: translate(-50%, -50%) scale(1.45); }
	100% { opacity: 0; transform: translate(-50%, -50%) scale(.86); }
}

@keyframes candy-match-ring {
	0% { opacity: 0; transform: translate(-50%, -50%) scale(.18); }
	24% { opacity: 1; }
	100% { opacity: 0; transform: translate(-50%, -50%) scale(1.7); }
}

@keyframes candy-match-spark {
	0% { opacity: 0; transform: translate(-50%, -50%) scale(.25); }
	18% { opacity: 1; }
	100% { opacity: 0; transform: translate(calc(-50% + var(--spark-x)), calc(-50% + var(--spark-y))) scale(.18) rotate(120deg); }
}

@keyframes candy-match-label {
	0% { opacity: 0; transform: translate(-50%, -105%) scale(.55); }
	24%, 66% { opacity: 1; transform: translate(-50%, -155%) scale(1); }
	100% { opacity: 0; transform: translate(-50%, -205%) scale(.94); }
}

@keyframes candy-grand-flash {
	0% { opacity: 0; }
	24% { opacity: 1; }
	100% { opacity: 0; }
}

@media (max-height: 820px) {
	.candy-home { padding-top: 3.2%; }
	.candy-home-kicker { margin-top: 0; font-size: 13px; }
	.candy-home-title { margin-top: 1%; font-size: clamp(34px, 9vw, 47px); }
	.candy-home-subtitle { margin-top: 1%; padding-block: 2px; }
	.candy-level-summary { margin-top: 2%; }
	.candy-level-main { min-height: 46px; }
	.candy-food-plate { margin-top: 2%; width: 64%; }
	.candy-food-token { width: clamp(44px, 11.5vw, 61px); }
	.candy-home-start { margin-top: 2%; padding: 9px 18px; }
	.candy-home-copy { margin-top: 2%; padding: 7px 12px; }
	.candy-home-copy strong { margin-bottom: 2px; }
	.candy-home-secondary { margin-top: 8px; }
	.candy-home-secondary .candy-home-button { padding: 8px 8px; }
}

/* ── Quit confirmation dialog ── */
.candy-quit-confirm {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(2px);
}

.candy-quit-confirm.is-hidden {
	display: none;
}

.candy-quit-panel {
	width: min(280px, 72vw);
	padding: 24px 20px 20px;
	text-align: center;
	background:
		radial-gradient(circle at 50% 0%, #5a1a12 0%, #321009 100%);
	border: 2px solid #f1c765;
	border-radius: 14px;
	box-shadow:
		0 0 0 3px rgba(68, 17, 12, 0.8),
		0 12px 32px rgba(0, 0, 0, 0.6);
}

.candy-quit-panel .panel-mark {
	color: #f1c765;
	font-size: 14px;
	margin-bottom: 6px;
}

.candy-quit-panel h2 {
	color: #fff0bd;
	font: 700 clamp(16px, 4.5vw, 20px) "STKaiti", "KaiTi", "Microsoft YaHei", sans-serif;
	margin-bottom: 10px;
}

.candy-quit-score-line {
	color: #e8d4a8;
	font-size: 14px;
	margin-bottom: 18px;
}

.candy-quit-score-line strong {
	color: #ffe184;
	font-size: 22px;
}

.candy-quit-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: center;
}

.candy-quit-actions .ancient-button {
	width: 100%;
	max-width: 200px;
}

.candy-quit-actions .text-button {
	color: #c9a86a;
	font-size: 14px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px;
}
