@font-face {
	font-family: "AL Brand";
	src: url("/fonts/al-Bold.otf") format("opentype");
	font-weight: 700;
	font-display: swap;
}
:root {
	color-scheme: light;
	--ink: #293e32;
	--rose: #be123c;
	--paper: #fff8e8;
	--edge: #e6d6b6;
	font-family: system-ui, sans-serif;
	color: var(--ink);
	background: #f3ead8;
}
* {
	box-sizing: border-box;
}
body {
	margin: 0;
	min-height: 100vh;
	min-height: 100svh;
	display: grid;
	place-items: center;
	padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
		max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
	background: radial-gradient(ellipse at 45% 10%, #fff9e9, #efe2c8);
}
.game {
	width: min(740px, 100%);
	isolation: isolate;
	position: relative;
	background: var(--paper);
	border: 1px solid var(--edge);
	border-radius: 28px;
	padding: clamp(12px, 2vw, 24px);
	box-shadow: 0 12px 38px -25px #72583980;
}
.game [hidden] {
	display: none;
}
button {
	font: inherit;
	color: inherit;
	border: 0;
	background: transparent;
	padding: 0;
	cursor: pointer;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}
button:focus-visible {
	outline: 3px solid #195b83;
	outline-offset: 3px;
	z-index: 4;
}
button:disabled {
	cursor: default;
}
img {
	display: block;
	pointer-events: none;
	user-select: none;
	-webkit-user-drag: none;
}
.tools {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 44px;
	gap: 7px;
}
h1,
.bubble {
	font-family: "AL Brand", Georgia, serif;
	font-weight: 700;
}
h1 {
	margin: 0;
	font-size: clamp(24px, 4.5vw, 38px);
	line-height: 1;
	letter-spacing: -0.04em;
}
h1 span {
	color: #9f1239;
}
.game:not([data-phase="ready"]) h1 {
	visibility: hidden;
}
.controls {
	display: flex;
	gap: 3px;
	align-items: center;
	margin-left: auto;
}
.controls button,
.controls #home {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	color: #43594b;
}
.controls button:active,
.bubble:active {
	scale: 0.97;
}
.controls svg {
	width: 24px;
	height: 24px;
}
#home svg {
	fill: none;
	stroke: currentColor;
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}
#home:focus-visible {
	outline: 3px solid #195b83;
	outline-offset: 3px;
}
.controls img {
	width: 36px;
	height: 36px;
	object-fit: contain;
}
#sound .on,
#sound .off,
.pause-bars {
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-width: 2.7;
}
#pause .pause-bars {
	stroke-width: 5;
}
#sound .off,
#sound[aria-pressed="false"] .on,
.resume-arrow,
#pause[aria-pressed="true"] .pause-bars {
	display: none;
}
#sound[aria-pressed="false"] .off,
#pause[aria-pressed="true"] .resume-arrow {
	display: block;
}
.guide {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: clamp(14px, 5vw, 42px);
	height: clamp(155px, 29svh, 240px);
	margin-bottom: 12px;
}
#momo {
	height: 100%;
	width: 31%;
	max-width: 178px;
	position: relative;
	border-radius: 32%;
	transform-origin: 50% 95%;
}
#momo::before {
	content: "";
	position: absolute;
	bottom: 0;
	left: 15%;
	width: 72%;
	height: 5%;
	background: #6b563a32;
	border-radius: 50%;
	filter: blur(3px);
}
#pose {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center bottom;
	position: relative;
}
.bubble {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: clamp(7px, 2vw, 16px);
	position: relative;
	width: min(48%, 300px);
	min-height: 77px;
	padding: 12px 16px;
	background: #fffdf6;
	border: 2px solid var(--edge);
	border-radius: 24px;
	box-shadow: 0 3px 0 #e6d6b6;
	font-size: clamp(22px, 3.4vw, 31px);
	line-height: 1.05;
	text-align: left;
}
.bubble::before {
	content: "";
	width: 13px;
	height: 13px;
	background: inherit;
	position: absolute;
	left: -8px;
	bottom: 21%;
	transform: rotate(45deg);
	border-left: 2px solid var(--edge);
	border-bottom: 2px solid var(--edge);
}
.cue-icon {
	position: relative;
	display: grid;
	place-items: center;
	flex: none;
}
.cue-icon img {
	width: clamp(42px, 8vw, 65px);
	height: clamp(42px, 8vw, 65px);
	object-fit: contain;
}
[data-theme="ark"] #cue-picture[src$="st-noah.webp"] {
	width: clamp(48px, 12vw, 78px);
	height: auto;
	border-radius: 6px;
}
#play-icon {
	width: 27px;
	height: 27px;
}
[data-phase="ready"] .bubble,
.game.paused .bubble {
	color: #fff9e9;
	background: var(--rose);
	border-color: #9f1239;
	box-shadow: 0 3px 0 #881337;
}
[data-phase="ready"] .bubble::before,
.game.paused .bubble::before {
	border-color: #9f1239;
}
#keepsake {
	position: absolute;
	height: 33%;
	width: 14%;
	object-fit: contain;
	bottom: 0;
	left: 42%;
	pointer-events: none;
}
.blanket {
	position: relative;
	border-radius: 19px;
	padding: clamp(12px, 2.7vw, 21px);
	background-color: #faebd2;
	background-image:
		repeating-linear-gradient(90deg, rgba(198, 94, 69, 0.08) 0 16px, transparent 16px 32px),
		repeating-linear-gradient(0deg, rgba(198, 94, 69, 0.08) 0 16px, transparent 16px 32px);
}
.blanket::before {
	content: "";
	position: absolute;
	inset: 6px;
	border: 1px dashed #bb9275;
	border-radius: 14px;
	pointer-events: none;
}
.choices {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	align-items: center;
	gap: clamp(5px, 2vw, 18px);
}
.piece {
	position: relative;
	border-radius: 29%;
	width: 100%;
	height: clamp(110px, 23svh, 183px);
	isolation: isolate;
}
.piece::before {
	content: "";
	position: absolute;
	z-index: -1;
	left: 17%;
	right: 17%;
	bottom: 6%;
	height: 12%;
	border-radius: 50%;
	background: #976d3d26;
	filter: blur(4px);
}
.piece img {
	position: absolute;
	left: 6%;
	bottom: 9%;
	width: 88%;
	height: 83%;
	object-fit: contain;
	object-position: center bottom;
	transform-origin: 50% 88%;
}
.piece.packed img,
.piece.taken img {
	visibility: hidden;
}
.piece.packed::before,
.piece.taken::before {
	opacity: 0;
}
[data-phase="celebrate"] .piece:not(.taken) {
	opacity: 0.42;
}
.piece.hint::before {
	background: #f3c473;
	height: 20%;
	filter: none;
}
.game.paused .choices {
	opacity: 0.45;
}
.flight {
	position: fixed;
	z-index: 12;
	pointer-events: none;
	object-fit: contain;
	transform-origin: center;
}
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}
@keyframes nod {
	35% {
		transform: rotate(-4deg);
	}
	70% {
		transform: rotate(2deg);
	}
}
@keyframes hop {
	40% {
		transform: translateY(-7%) rotate(-4deg);
	}
	70% {
		transform: rotate(3deg);
	}
}
@keyframes land {
	from {
		opacity: 0.35;
		transform: translateY(-10%) rotate(-3deg);
	}
	to {
		opacity: 1;
		transform: none;
	}
}
@media (prefers-reduced-motion: no-preference) {
	#momo.gesture,
	.controls .gesture {
		animation: nod 0.7s ease-in-out 2;
	}
	.piece.hint img,
	.bubble.gesture .cue-icon img {
		animation: hop 0.65s ease-in-out 2;
	}
	.choices.deal .piece img {
		animation: land 0.36s ease-out backwards;
	}
	.choices.deal .piece:nth-child(2) img {
		animation-delay: 0.05s;
	}
	.choices.deal .piece:nth-child(3) img {
		animation-delay: 0.1s;
	}
}
@media (max-width: 540px) and (orientation: portrait) {
	body {
		padding: max(8px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right))
			max(8px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
	}
	.game {
		padding: 10px;
		border-radius: 22px;
	}
	.guide {
		height: clamp(130px, 27svh, 232px);
		gap: 12px;
		margin: 0 0 10px;
	}
	#momo {
		width: 32%;
	}
	.bubble {
		width: 54%;
		padding: 9px;
		min-height: 60px;
		border-radius: 20px;
		font-size: clamp(21px, 5.6vw, 26px);
	}
	.choices {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 3px 9px;
	}
	.piece {
		grid-column: span 2;
		height: clamp(86px, 21svh, 182px);
	}
	.piece:last-child {
		grid-column: 2 / span 2;
	}
	#keepsake {
		left: 34%;
	}
}
@media (orientation: landscape) and (max-height: 510px) {
	body {
		padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
			max(6px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
	}
	.game {
		display: grid;
		width: min(900px, 100%);
		grid-template-columns: 39% 61%;
		padding: 8px;
	}
	.tools {
		grid-column: 1 / -1;
	}
	h1 {
		padding-left: 7px;
		font-size: 26px;
	}
	.guide {
		height: clamp(160px, 60svh, 226px);
		flex-direction: column-reverse;
		gap: 4px;
		margin: 0;
	}
	#momo {
		height: calc(100% - 53px);
		width: 66%;
	}
	.bubble {
		min-height: 44px;
		width: 90%;
		padding: 4px 8px;
		font-size: 18px;
		border-radius: 16px;
	}
	.bubble::before {
		display: none;
	}
	[data-theme="ark"] #cue-picture[src$="st-noah.webp"] {
		width: 30px;
	}
	.cue-icon img {
		width: 32px;
		height: 32px;
	}
	#keepsake {
		left: 64%;
		width: 23%;
		height: 26%;
	}
	.blanket {
		align-content: center;
		padding: 9px;
	}
	.piece {
		height: clamp(77px, 35svh, 146px);
	}
}

#fruit-basket {
	position: absolute;
	height: 38%;
	width: 18%;
	object-fit: contain;
	bottom: 0;
	left: 39%;
}
#fruit-basket:not([hidden]) + #keepsake {
	left: 44%;
	width: 8%;
	height: 18%;
	bottom: 6%;
}
@media (max-width: 540px) and (orientation: portrait) {
	#fruit-basket {
		left: 31%;
	}
	#fruit-basket:not([hidden]) + #keepsake {
		left: 36%;
	}
}
@media (orientation: landscape) and (max-height: 510px) {
	#fruit-basket {
		left: 60%;
		width: 30%;
		height: 32%;
	}
	#fruit-basket:not([hidden]) + #keepsake {
		left: 68%;
		width: 13%;
		height: 15%;
	}
}

.cue-icon #keepsake {
	width: 70%;
	height: 58%;
	left: auto;
	right: -9%;
	bottom: -5%;
	object-position: center bottom;
	filter: drop-shadow(0 2px 2px #39271b66);
}
#cue-picture[hidden] ~ #keepsake,
#cue-picture[src$="dove.webp"] ~ #keepsake {
	display: none;
}

/* The ten-frame fits in the title's space while the child is playing. */
.game:not([data-phase="ready"]) h1,
.tools:has(.ten-frame:not([hidden])) h1 {
	display: none;
}
.ten-frame {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 3px 5px;
	align-content: center;
	padding: 4px 8px;
	border-radius: 10px;
	background: #fffdf4;
	border: 1px solid #d5c8aa;
}
.ten-frame > span {
	display: block;
	width: clamp(12px, 3.8vw, 17px);
	aspect-ratio: 1;
	border-radius: 50%;
	border: 1.5px dashed #9b8b69;
	background: #f0e9d5;
}
.ten-frame .filled {
	background: #f4b83f;
	border: 2px solid #905c17;
	box-shadow: inset 0 0 0 2px #ffe6a2;
}
.game[data-hint]:not(.paused) .piece.hint {
	background: #ffe59b;
	box-shadow:
		inset 0 0 0 4px #905510,
		inset 0 0 0 8px #ffcf4f;
}
.game[data-hint="2"]:not(.paused) .piece.hint::after {
	content: "";
	position: absolute;
	z-index: 2;
	right: 2%;
	top: -3%;
	width: clamp(38px, 34%, 62px);
	height: 37%;
	background: url("./art/pointing-hand.webp") center / contain no-repeat;
	transform: rotate(130deg);
	filter: drop-shadow(0 2px 2px #644b25aa);
}
.game[data-hint="2"]:not(.paused) .piece:not(.hint) {
	opacity: 0.58;
}
.other-game {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: fit-content;
	margin: 4px auto 0;
	padding: 3px 10px;
	min-height: 44px;
	color: #385548;
	font:
		700 17px "AL Brand",
		Georgia,
		serif;
	text-decoration: none;
	border-radius: 10px;
}
.other-game img {
	object-fit: contain;
	width: 27px;
	height: 30px;
	border-radius: 4px;
}
.game[data-phase="ready"] .other-game,
.game[data-phase="complete"] .other-game,
.game.paused .other-game {
	display: flex;
}
.end-card {
	padding: 9px;
	border-radius: 17px;
	background: #f3e7c8;
	text-align: center;
}
.stickers {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 5px;
	max-width: 405px;
	margin: 0 auto 8px;
}
.stickers > span {
	display: flex;
	justify-content: center;
	align-items: end;
	height: clamp(32px, 8svh, 65px);
	border-radius: 10px;
	background: #fffaf0;
}
.stickers img {
	width: 75%;
	height: 90%;
	object-fit: contain;
}
.ark-game .stickers img {
	width: 47%;
}
.replay {
	min-height: 46px;
	min-width: 132px;
	padding: 7px 16px;
	display: inline-flex;
	align-items: center;
	gap: 9px;
	border-radius: 20px;
	color: #fff9e9;
	background: #a52242;
	font:
		700 22px "AL Brand",
		Georgia,
		serif;
}
.replay svg {
	width: 27px;
	height: 27px;
	fill: none;
	stroke: currentColor;
	stroke-width: 3;
	stroke-linecap: round;
	stroke-linejoin: round;
}
@media (prefers-reduced-motion: no-preference) {
	.just-found {
		animation: stamp 0.36s ease-out;
	}
	@keyframes stamp {
		from {
			transform: scale(0.55);
		}
		70% {
			transform: scale(1.22);
		}
	}
}
@media (orientation: landscape) and (max-height: 510px) {
	.other-game {
		grid-column: 1 / -1;
		min-height: 44px;
		margin-top: 0;
	}
	.ten-frame {
		gap: 2px 4px;
	}
}
