/* 小綿羊迷宮大作戰 — round 3 styling.
   No pill controls, no emoji pictograms, no generic card grid.
   Every motion step stays under 300ms and honours prefers-reduced-motion. */

/* Tokens sampled from the live storefront (www.mimingmart.com, 2026-09-21), so
   the game reads as part of the shop rather than a widget dropped onto it:
     page #f5f5f5 · panels #fff · text #333 · brand teal #60CAC8
     buttons #52A6A5 on white, 8px radius · system-ui stack
   The storefront carries ZERO prefers-color-scheme rules and never goes dark, so
   neither does this game. A dark game on a white shop was the bug. */
.mmz {
	color-scheme: light;
	--mmz-teal: #60cac8;          /* brand accent, as used on the storefront */
	--mmz-teal-deep: #52a6a5;     /* the shop's button teal — fills only */
	--mmz-teal-text: #2c8280;     /* darkened for text: 4.55:1 on white */
	--mmz-teal-dark: #3d7f7e;     /* hover */
	--mmz-ink: #333333;           /* the storefront's text colour */
	--mmz-body: #555555;
	--mmz-muted: #6b6b6b;         /* 4.5:1 even on the #f5f5f5 page, where the hint sits */
	--mmz-line: #e5e5e5;
	--mmz-tint: #eef8f8;
	--mmz-panel: #ffffff;
	--mmz-page: #f5f5f5;
	--mmz-warn: #c0483f;
	--mmz-toast-bg: #333333;
	--mmz-toast-fg: #ffffff;
	--mmz-toast-line: #333333;
	--mmz-gold: #c89a5c;
	--mmz-step: 150ms;
	--mmz-ease: cubic-bezier(.34, .8, .36, 1);

	position: relative;
	box-sizing: border-box;
	max-width: 760px;
	margin: 0 auto;
	padding: 20px 16px 28px;
	background: var(--mmz-page);
	color: var(--mmz-body);
	font-family: system-ui, -apple-system, "Segoe UI", "Microsoft JhengHei", "PingFang TC",
		"Noto Sans TC", Roboto, "Helvetica Neue", Arial, sans-serif;
	line-height: 1.6;
	border: 1px solid var(--mmz-line);
	border-radius: 14px;
	overflow: hidden;
}
.mmz *, .mmz *::before, .mmz *::after { box-sizing: inherit; }

/* ------------------------------- header ------------------------------- */
.mmz__head { text-align: center; margin-bottom: 14px; }
.mmz__eyebrow {
	display: inline-block;
	font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
	color: var(--mmz-teal-text); font-weight: 700;
}
.mmz__title {
	margin: 4px 0 6px;
	font-size: clamp(22px, 5.6vw, 32px); line-height: 1.2;
	color: var(--mmz-ink); font-weight: 800;
}
.mmz__title em { font-style: normal; color: var(--mmz-teal-text); }
.mmz__sub { margin: 0; font-size: 14px; color: var(--mmz-body); }

/* --------------------------------- HUD --------------------------------- */
.mmz__hud {
	display: grid;
	grid-template-columns: 1fr 1fr auto;
	gap: 8px 14px;
	align-items: center;
	padding: 10px 12px;
	margin-bottom: 12px;
	background: var(--mmz-panel);
	border: 1px solid var(--mmz-line);
	border-radius: 10px;
}
.mmz__stat { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mmz__stat-label {
	font-size: 11px; color: var(--mmz-muted); white-space: nowrap;
	letter-spacing: .04em;
}
.mmz__stat-num { font-size: 14px; color: var(--mmz-ink); font-weight: 700; white-space: nowrap; }
.mmz__stat-num b { font-size: 18px; font-variant-numeric: tabular-nums; }
.mmz__stat-num i { font-style: normal; font-size: 11px; color: var(--mmz-muted); margin-left: 2px; }

.mmz__meter {
	position: relative; flex: 1 1 auto; min-width: 42px; height: 8px;
	background: var(--mmz-tint); border-radius: 4px; overflow: hidden;
	--mmz-purity: 100%;
}
.mmz__meter-fill {
	position: absolute; inset: 0 auto 0 0; width: var(--mmz-purity);
	background: linear-gradient(90deg, var(--mmz-teal), var(--mmz-teal-deep));
	transition: width 260ms var(--mmz-ease), background 260ms linear;
}
.mmz--danger .mmz__meter-fill { background: linear-gradient(90deg, #e08b83, var(--mmz-warn)); }

/* Basket slots. Empty slots show a "?"; a collected one shows the real product
   photograph and becomes a button that opens it full size. */
.mmz__slots { display: flex; gap: 5px; flex: 0 0 auto; }
.mmz__slot {
	position: relative;
	display: grid; place-items: center;
	width: 34px; height: 34px; padding: 0;
	background: var(--mmz-tint);
	border: 1px solid var(--mmz-line); border-radius: 6px;
	color: var(--mmz-muted); font: inherit; font-weight: 800; font-size: 15px;
	cursor: default; overflow: hidden;
	transition: border-color 200ms var(--mmz-ease), background 200ms var(--mmz-ease);
}
.mmz__slot.is-on {
	background: #fff; border-color: var(--mmz-teal-text); cursor: pointer;
}
.mmz__slot.is-on:hover { border-color: var(--mmz-teal-dark); }
.mmz__slot:focus-visible { outline: 3px solid var(--mmz-teal-deep); outline-offset: 2px; }
.mmz__slot img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mmz__slot img[hidden] { display: none; }
.mmz__slot-q[hidden] { display: none; }

/* Board items are buttons: tap one to read what it is. */
.mmz__prod, .mmz__tox { cursor: pointer; }
.mmz__prod:focus-visible .mmz__prod-tile { stroke: var(--mmz-ink); stroke-width: 2.6; }
.mmz__prod:focus-visible, .mmz__tox:focus-visible { outline: none; }
.mmz__tox:focus-visible { filter: drop-shadow(0 0 0 2px var(--mmz-ink)); }
.mmz__prod-q { display: none; }

.mmz--hurry .mmz__stat--clock .mmz__stat-num b { color: var(--mmz-warn); }
.mmz--hurry .mmz__stat--clock { animation: mmz-pulse 900ms ease-in-out infinite; }
@keyframes mmz-pulse { 50% { opacity: .55; } }

/* -------------------------------- board -------------------------------- */
.mmz__board { position: relative; }
.mmz__svg {
	display: block;
	width: 100%; max-width: 520px; margin: 0 auto;
	aspect-ratio: 1 / 1; height: auto;
	background: var(--mmz-panel);
	border: 1px solid var(--mmz-line);
	border-radius: 10px;
	touch-action: none;
}
.mmz__svg:focus-visible { outline: 3px solid var(--mmz-teal-deep); outline-offset: 2px; }

.mmz__walls {
	stroke: var(--mmz-teal-dark);
	stroke-width: 3;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.mmz__floor { opacity: 1; }

.mmz__gate-label {
	font-size: 11px; font-weight: 800; fill: var(--mmz-teal-text);
	font-family: inherit; paint-order: stroke;
	stroke: var(--mmz-panel); stroke-width: 3px; stroke-linejoin: round;
}
.mmz__gate-glow { opacity: 0; transition: opacity 260ms var(--mmz-ease); }
.mmz__gate[data-open="1"] .mmz__gate-glow { opacity: 1; }
.mmz__gate[data-open="1"] .mmz__gate-lock { opacity: 0; transform: translateY(6px); }
.mmz__gate-lock { transition: opacity 220ms var(--mmz-ease), transform 220ms var(--mmz-ease); }
.mmz__gate[data-open="1"] .mmz__gate-bars { opacity: .25; }
.mmz__gate-bars { transition: opacity 220ms var(--mmz-ease); }
.mmz--open .mmz__gate { animation: mmz-gate-breathe 1.8s ease-in-out infinite; }
@keyframes mmz-gate-breathe { 50% { opacity: .78; } }

/* Products and hazards sit STILL.
   They carried an idle bob and an opacity pulse; with 12 tokens on a 12x12 board
   that read as noise and made the board harder to scan, which is the one thing
   the player is actually doing. Motion here is reserved for state changes:
   collecting an item, spending a hazard, the gate unlocking, the clock running
   down. Nothing loops just to look alive. */

/* products */
.mmz__prod { transition: opacity 200ms var(--mmz-ease), transform 200ms var(--mmz-ease); }
.mmz__prod-tile {
	fill: #fff; stroke: var(--mmz-teal); stroke-width: 1.4;
	filter: drop-shadow(0 1px 1.5px rgba(45, 42, 38, .18));
}
.mmz__prod.is-taken { opacity: 0; transform: scale(1.5); pointer-events: none; }

/* hazards */
.mmz__tox { transform-box: fill-box; transform-origin: center; }
.mmz__tox.is-spent { opacity: 0; transition: opacity 260ms var(--mmz-ease); }

/* sheep */
.mmz__sheep { transition: transform var(--mmz-step) var(--mmz-ease); }
.mmz__sheep-body { transition: transform 160ms var(--mmz-ease); }
.mmz__sheep[data-facing="left"] .mmz__sheep-body { transform: scaleX(-1); }
.mmz__sheep[data-facing="left"] .mmz__sheep-basket { transform: translate(7.6px, 1.6px) scaleX(-1); }
/* Legs trot only while the sheep is actually walking — a standing sheep that
   keeps pedalling reads as a glitch. The engine adds .mmz--walking on a step and
   drops it once the sheep has been still for one step's worth of time. */
.mmz__leg { transform-box: fill-box; transform-origin: top center; }
.mmz--walking .mmz__leg { animation: mmz-trot 380ms linear infinite; }
.mmz--walking .mmz__leg--b { animation-delay: -190ms; }
@keyframes mmz-trot { 50% { transform: translateY(-1.2px); } }

.mmz--bump .mmz__sheep-body { transform: translateX(1.5px); }
.mmz--bump .mmz__sheep[data-facing="left"] .mmz__sheep-body { transform: translateX(-1.5px) scaleX(-1); }
.mmz--hit .mmz__sheep { animation: mmz-shake 400ms var(--mmz-ease); }
@keyframes mmz-shake {
	25% { filter: brightness(.8) saturate(1.6); }
	75% { filter: brightness(1.1); }
}

/* toast */
.mmz__toast {
	position: absolute; left: 50%; top: 12px;
	transform: translate(-50%, -8px);
	margin: 0; padding: 8px 15px;
	/* Its own tokens on purpose. This used to be `background: var(--mmz-ink);
	   color:#fff`, and --mmz-ink flips to near-white in dark mode — so the toast
	   became white text on a white slab and the hit message was unreadable. */
	background: var(--mmz-toast-bg); color: var(--mmz-toast-fg);
	border: 1px solid var(--mmz-toast-line);
	font-size: 14px; font-weight: 700;
	border-radius: 6px;
	box-shadow: 0 3px 12px rgba(0, 0, 0, .28);
	opacity: 0; pointer-events: none;
	transition: opacity 200ms var(--mmz-ease), transform 200ms var(--mmz-ease);
	max-width: 88%; text-align: center;
}
.mmz__toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------- reveal ------------------------------- */
.mmz__reveal {
	position: absolute; inset: 0; z-index: 8;
	display: none; align-items: center; justify-content: center;
	padding: 20px;
	background: rgba(45, 42, 38, .62);
	backdrop-filter: blur(3px);
}
.mmz__reveal.is-open { display: flex; }
.mmz__reveal[hidden] { display: none; }
.mmz__reveal-card {
	position: relative;
	width: 100%; max-width: 320px;
	padding: 20px;
	background: var(--mmz-panel);
	border-radius: 12px;
	text-align: center;
	box-shadow: 0 10px 34px rgba(45, 42, 38, .3);
}
.mmz__reveal-img {
	width: 100%; max-width: 220px; height: auto; aspect-ratio: 1 / 1;
	object-fit: contain;
	background: #fff; border-radius: 8px;
	margin-bottom: 12px;
}
.mmz__reveal-brand {
	margin: 0 0 2px;
	font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
	color: var(--mmz-teal-text); font-weight: 700;
}
.mmz__reveal-name { margin: 0 0 14px; font-size: 15px; font-weight: 700; color: var(--mmz-ink); }
.mmz__reveal-link {
	display: inline-block; padding: 9px 20px;
	background: var(--mmz-teal-text); color: #fff;
	font-size: 14px; font-weight: 700; text-decoration: none;
	border-radius: 8px;
}
.mmz__reveal-link:hover { background: var(--mmz-teal-dark); }
.mmz__reveal-link[hidden] { display: none; }
.mmz__reveal-close {
	position: absolute; top: 8px; right: 8px;
	width: 32px; height: 32px; padding: 0;
	background: transparent; border: 0; border-radius: 6px;
	color: var(--mmz-muted); font-size: 16px; cursor: pointer;
}
.mmz__reveal-close:hover { background: var(--mmz-tint); color: var(--mmz-ink); }

/* --------------------------------- pad --------------------------------- */
.mmz__pad {
	display: grid;
	grid-template-areas: ". up ." "left . right" ". down .";
	grid-template-columns: repeat(3, 56px);
	grid-template-rows: repeat(3, 56px);
	justify-content: center;
	gap: 6px;
	margin: 14px auto 0;
}
.mmz__padbtn {
	display: grid; place-items: center;
	width: 56px; height: 56px; padding: 0;
	background: var(--mmz-panel);
	border: 1px solid var(--mmz-line);
	border-radius: 8px;
	color: var(--mmz-teal-text);
	cursor: pointer;
	touch-action: none;
	transition: background 140ms var(--mmz-ease), transform 140ms var(--mmz-ease);
}
.mmz__padbtn:active { background: var(--mmz-tint); transform: scale(.94); }
.mmz__padbtn:focus-visible { outline: 3px solid var(--mmz-teal-deep); outline-offset: 2px; }
.mmz__padbtn svg { width: 26px; height: 26px; fill: currentColor; }
.mmz__padbtn--up { grid-area: up; }
.mmz__padbtn--left { grid-area: left; }
.mmz__padbtn--right { grid-area: right; }
.mmz__padbtn--down { grid-area: down; }

.mmz__hint { margin: 10px 0 0; text-align: center; font-size: 12px; color: var(--mmz-muted); }

/* screen-reader only */
.mmz__sr {
	position: absolute; width: 1px; height: 1px; margin: -1px;
	padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------- screens ------------------------------- */
.mmz__screen {
	position: absolute; inset: 0; z-index: 5;
	display: none;
	align-items: center; justify-content: center;
	padding: 16px;
	background: rgba(45, 42, 38, .55);
	backdrop-filter: blur(3px);
}
.mmz__screen.is-open, .mmz__screen[data-mmz-screen="intro"]:not([hidden]) { display: flex; }
.mmz__panel {
	position: relative;
	width: 100%; max-width: 420px;
	max-height: 100%; overflow-y: auto;
	padding: 22px 20px;
	background: var(--mmz-panel);
	border-radius: 12px;
	text-align: center;
	box-shadow: 0 10px 34px rgba(45, 42, 38, .26);
}
.mmz__panel--form, .mmz__panel--tnc { text-align: left; }
.mmz__panel-kicker {
	margin: 0 0 4px;
	font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
	color: var(--mmz-teal-text); font-weight: 700;
}
.mmz__panel-title { margin: 0 0 8px; font-size: 20px; color: var(--mmz-ink); font-weight: 800; }
.mmz__panel-body { margin: 0 0 16px; font-size: 14px; }
.mmz__panel-note { margin: 12px 0 0; font-size: 12px; color: var(--mmz-muted); }
.mmz__panel-close {
	position: absolute; top: 8px; right: 8px;
	width: 32px; height: 32px; padding: 0;
	background: transparent; border: 0; border-radius: 6px;
	color: var(--mmz-muted); font-size: 16px; cursor: pointer;
}
.mmz__panel-close:hover { background: var(--mmz-tint); color: var(--mmz-ink); }

.mmz__btn-primary {
	display: inline-block;
	padding: 12px 26px;
	background: var(--mmz-teal-text); color: #fff;
	font-size: 15px; font-weight: 700; font-family: inherit;
	border: 0; border-radius: 8px;
	cursor: pointer; text-decoration: none;
	transition: background 160ms var(--mmz-ease), transform 160ms var(--mmz-ease);
}
.mmz__btn-primary:hover { background: var(--mmz-teal-dark); }
.mmz__btn-primary:active { transform: translateY(1px); }
.mmz__btn-primary:disabled, .mmz__btn-primary.is-loading { opacity: .6; cursor: default; }
.mmz__btn-primary:focus-visible { outline: 3px solid var(--mmz-ink); outline-offset: 2px; }

.mmz__replay {
	display: block; margin: 14px auto 0; padding: 8px 18px;
	background: transparent; color: var(--mmz-teal-text);
	border: 1px solid var(--mmz-teal); border-radius: 8px;
	font-size: 14px; font-family: inherit; font-weight: 600; cursor: pointer;
}
.mmz__replay:hover { background: var(--mmz-tint); }

/* prize */
.mmz__prize {
	display: flex; align-items: center; gap: 12px;
	padding: 12px; margin-bottom: 14px;
	background: var(--mmz-tint); border-radius: 8px;
}
.mmz__prize-img { width: 64px; height: 64px; object-fit: contain; border-radius: 6px; background: #fff; }
.mmz__prize-name { margin: 0; font-size: 14px; font-weight: 700; color: var(--mmz-ink); }
.mmz__prize-value { margin: 2px 0 0; font-size: 12px; color: var(--mmz-teal-text); }

/* form */
.mmz__field { margin-bottom: 12px; }
.mmz__field label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: var(--mmz-ink); }
.mmz__field input[type="text"], .mmz__field input[type="tel"],
.mmz__field input[type="email"], .mmz__field select {
	width: 100%; padding: 10px 12px;
	font-size: 16px;                       /* 16px stops iOS zooming the page on focus */
	font-family: inherit; color: var(--mmz-ink);
	background: #fff;
	border: 1px solid var(--mmz-line); border-radius: 7px;
}
.mmz__field input:focus-visible, .mmz__field select:focus-visible {
	outline: 2px solid var(--mmz-teal-deep); outline-offset: 1px; border-color: var(--mmz-teal-text);
}
.mmz__field input[aria-invalid="true"] { border-color: var(--mmz-warn); }
.mmz__field--hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.mmz__field--consent label {
	display: flex; gap: 8px; align-items: flex-start;
	font-weight: 400; font-size: 13px; color: var(--mmz-body); margin-bottom: 8px;
}
.mmz__field--consent input { flex: 0 0 auto; margin-top: 3px; width: 18px; height: 18px; }
.mmz__field-err { display: block; margin-top: 4px; font-size: 12px; color: var(--mmz-warn); }
.mmz__form-error {
	margin: 0 0 12px; padding: 9px 12px;
	background: #fdecea; color: var(--mmz-warn);
	font-size: 13px; border-radius: 6px;
}
.mmz__link-btn {
	padding: 0; background: none; border: 0;
	color: var(--mmz-teal-text); font: inherit; text-decoration: underline; cursor: pointer;
}
.mmz__pics { margin-bottom: 14px; font-size: 12px; color: var(--mmz-muted); }
.mmz__pics summary { cursor: pointer; color: var(--mmz-teal-text); font-weight: 600; }
.mmz__pics p { margin: 6px 0 0; }
.mmz__pics a { color: var(--mmz-teal-text); }
.mmz__draw-note { margin: 0 0 12px; font-size: 12px; color: var(--mmz-body); }
.mmz__form-error[hidden] { display: none; }

/* code chip */
.mmz__code { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.mmz__code-chip {
	padding: 9px 16px;
	background: var(--mmz-tint); color: var(--mmz-ink);
	font-size: 17px; font-weight: 800; letter-spacing: .1em;
	border: 1px dashed var(--mmz-teal-deep); border-radius: 6px;
}
.mmz__copy {
	padding: 8px 14px; background: transparent;
	border: 1px solid var(--mmz-line); border-radius: 7px;
	font-size: 13px; font-family: inherit; color: var(--mmz-body); cursor: pointer;
}

/* T&C */
.mmz__tnc-list { margin: 0 0 16px; padding: 0 0 0 4px; list-style: none; }
.mmz__tnc-list li { margin-bottom: 8px; font-size: 13px; line-height: 1.7; }

/* ------------------------------ responsive ------------------------------ */
@media (max-width: 430px) {
	.mmz__slot { width: 30px; height: 30px; font-size: 14px; }
	.mmz__slots { gap: 4px; }
	.mmz { padding: 16px 12px 22px; border-radius: 0; border-left: 0; border-right: 0; }
	.mmz__hud { grid-template-columns: 1fr auto; gap: 6px 10px; padding: 9px 10px; }
	.mmz__stat--clock { grid-column: 2; grid-row: 1; }
	.mmz__stat--basket { grid-column: 1 / -1; }
	.mmz__pad { grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(3, 52px); }
	.mmz__padbtn { width: 52px; height: 52px; }
	.mmz__panel { padding: 18px 16px; }
}

/* pointer-coarse devices get the pad; a mouse user does not need it */
@media (hover: hover) and (pointer: fine) {
	.mmz__pad { display: none; }
}

/* ---------------------------- reduced motion ---------------------------- */
@media (prefers-reduced-motion: reduce) {
	.mmz *, .mmz *::before, .mmz *::after {
		animation-duration: .001ms !important;
		animation-iteration-count: 1 !important;
	}
	/* positional movement stays — it is the game, not decoration */
	.mmz__sheep { transition: transform var(--mmz-step) linear; }
}
.mmz--reduced .mmz__leg, .mmz--reduced .mmz__gate { animation: none; }

/* hazard artwork inside the detail panel */
.mmz__reveal-glyph {
	width: 100%; max-width: 150px; height: auto; aspect-ratio: 1 / 1;
	display: block; margin: 0 auto 12px;
}
.mmz__reveal-glyph[hidden] { display: none; }
.mmz__reveal[data-kind="toxic"] .mmz__reveal-brand { color: var(--mmz-warn); }
.mmz__reveal-note {
	margin: 0 0 4px; font-size: 13px; line-height: 1.6; color: var(--mmz-body);
}
.mmz__reveal-note[hidden] { display: none; }

/* pros / cons on a hazard panel */
.mmz__pc {
	display: grid; grid-template-columns: auto 1fr; gap: 8px;
	align-items: start; text-align: left;
	margin: 0 0 8px; padding: 9px 11px;
	border-radius: 8px; border: 1px solid var(--mmz-line);
	background: var(--mmz-tint);
}
.mmz__pc[hidden] { display: none; }
.mmz__pc-tag {
	flex: 0 0 auto; padding: 1px 8px;
	font-size: 11px; font-weight: 800; letter-spacing: .06em;
	border-radius: 5px; white-space: nowrap;
}
.mmz__pc--pro .mmz__pc-tag { background: var(--mmz-teal-text); color: #fff; }
.mmz__pc--con .mmz__pc-tag { background: var(--mmz-warn); color: #fff; }
.mmz__pc--con { border-color: rgba(192, 72, 63, .35); }
.mmz__pc-text { margin: 0; font-size: 13px; line-height: 1.65; color: var(--mmz-body); }

/* On the light board the white fleece needs an edge or the sheep dissolves into
   the floor. Stroke sits on the group so the overlapping circles read as one. */
.mmz__fleece circle { stroke: #b9cdcc; stroke-width: .9; }
.mmz__sheep { filter: drop-shadow(0 1px 1.5px rgba(51, 51, 51, .22)); }
