/* Type: Baloo 2, scale 1.25 | Color: accent orange, warm neutrals |
   Space: 4px base | Finish: 16px radius, thick ink outline + hard offset
   shadow (manga panel), signature: halftone dots and the grade stamp. */
:root {
	--font: 'Baloo 2', ui-rounded, 'Arial Rounded MT Bold', system-ui, sans-serif;
	--fs-1: 0.875rem;
	--fs-2: 1rem;
	--fs-3: 1.25rem;
	--fs-4: 1.563rem;
	--fs-5: 1.953rem;
	--fs-6: 3.052rem;
	--fs-7: 4.768rem;

	--paper: #fff5e3;
	--panel: #ffffff;
	--text: #1f1a2e;
	--muted: #6a6274;
	--line: #1f1a2e;
	--halftone: rgba(31, 26, 46, 0.07);
	--accent: #ff6b1a;
	--accent-soft: #ffe3cf;
	--on-accent: #1f1a2e;
	--gold: #ffc21a;
	--star-off: #e9e1d4;
	--good: #17a657;
	--good-soft: #d3f4df;
	--bad: #d6293f;
	--bad-soft: #fde1e5;
	--info: #2f6fea;
	--review: #2f6fea;
	--g-s: #ffb300;
	--g-ss: #19b7f0;
	--g-sss-a: #ff3d7f;
	--g-sss-b: #ffc21a;
	--g-sss-c: #19b7f0;

	--sp-1: 4px;
	--sp-2: 8px;
	--sp-3: 12px;
	--sp-4: 16px;
	--sp-5: 24px;
	--sp-6: 32px;
	--r-1: 10px;
	--r-2: 16px;
	--r-3: 24px;
	--r-full: 999px;
	--bw: 3px;
	--shadow: 4px 4px 0 var(--line);
	--shadow-sm: 2px 2px 0 var(--line);
	--shadow-lg: 6px 6px 0 var(--line);
	--ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
	--ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
	color-scheme: light;
}

/* Theme: data-theme on <html> is the player's choice (set before the first
   paint by the inline script of each page); without it, the phone setting. */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) {
		--paper: #17141f;
		--panel: #26222f;
		--text: #f7f0e4;
		--muted: #b8afc2;
		--line: #050408;
		--halftone: rgba(255, 245, 227, 0.05);
		--accent-soft: #4a2611;
		--star-off: #3b3546;
		--good-soft: #113d25;
		--bad-soft: #4a1720;
		--review: #7fa8ff;
		color-scheme: dark;
	}
}

:root[data-theme='dark'] {
	--paper: #17141f;
	--panel: #26222f;
	--text: #f7f0e4;
	--muted: #b8afc2;
	--line: #050408;
	--halftone: rgba(255, 245, 227, 0.05);
	--accent-soft: #4a2611;
	--star-off: #3b3546;
	--good-soft: #113d25;
	--bad-soft: #4a1720;
	--review: #7fa8ff;
	color-scheme: dark;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-height: 100%;
}

body {
	font-family: var(--font);
	font-size: var(--fs-2);
	line-height: 1.5;
	color: var(--text);
	background-color: var(--paper);
	background-image: radial-gradient(var(--halftone) 1.5px, transparent 1.6px);
	background-size: 14px 14px;
	-webkit-tap-highlight-color: transparent;
	overscroll-behavior: none;
}

h1,
h2,
p {
	margin: 0;
}

button {
	font: inherit;
	color: inherit;
}

svg {
	width: 1em;
	height: 1em;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

:focus-visible {
	outline: 3px solid var(--info);
	outline-offset: 3px;
}

.app {
	max-width: 480px;
	min-height: 100dvh;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: var(--sp-4);
	padding: calc(var(--sp-4) + env(safe-area-inset-top)) var(--sp-4) calc(var(--sp-4) + env(safe-area-inset-bottom));
}

/* ---------- Buttons ---------- */

.btn {
	min-height: 52px;
	padding: var(--sp-2) var(--sp-5);
	border: var(--bw) solid var(--line);
	border-radius: var(--r-2);
	background: var(--panel);
	box-shadow: var(--shadow);
	font-weight: 800;
	font-size: var(--fs-3);
	cursor: pointer;
	transition: transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
	touch-action: manipulation;
}

.btn:active,
.choice:active:not(:disabled),
.key:active:not(:disabled) {
	transform: translate(2px, 2px);
	box-shadow: var(--shadow-sm);
}

.btn-primary {
	background: var(--accent);
	color: var(--on-accent);
}

.btn-danger {
	color: var(--bad);
	border-color: var(--bad);
	box-shadow: 4px 4px 0 var(--bad);
}

.btn-xl {
	width: 100%;
	min-height: 68px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	line-height: 1.1;
	font-size: var(--fs-4);
}

.btn-xl small {
	font-size: var(--fs-1);
	font-weight: 700;
}

.icon-btn {
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	border: var(--bw) solid var(--line);
	border-radius: var(--r-full);
	background: var(--panel);
	font-size: 22px;
	cursor: pointer;
}

.dock {
	position: sticky;
	bottom: 0;
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
	padding-top: var(--sp-5);
	margin-top: auto;
	background: linear-gradient(transparent, var(--paper) var(--sp-5));
}

.dock-row {
	display: flex;
	gap: var(--sp-3);
}

.dock-row .btn {
	flex: 1;
	padding-inline: var(--sp-2);
	font-size: var(--fs-2);
}

/* ---------- Home ---------- */

.home-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.logo {
	font-size: var(--fs-5);
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.logo span {
	margin-left: 0.15em;
	padding: 0 0.25em;
	background: var(--accent);
	color: var(--on-accent);
	border: var(--bw) solid var(--line);
	border-radius: var(--r-1);
	box-shadow: var(--shadow-sm);
	display: inline-block;
	transform: rotate(-3deg);
}

.star-total {
	display: flex;
	align-items: center;
	gap: var(--sp-1);
	padding: var(--sp-1) var(--sp-3);
	border: var(--bw) solid var(--line);
	border-radius: var(--r-full);
	background: var(--panel);
	font-size: var(--fs-3);
	font-weight: 800;
}

.star-total svg {
	fill: var(--gold);
	stroke: var(--line);
	stroke-width: 1.6;
}

.tabs {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--sp-2);
}

.tab {
	min-height: 56px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	line-height: 1.1;
	padding: var(--sp-1);
	border: var(--bw) solid var(--line);
	border-radius: var(--r-2);
	background: var(--panel);
	font-weight: 700;
	font-size: var(--fs-1);
	cursor: pointer;
}

.tab-symbol {
	font-size: var(--fs-4);
	font-weight: 800;
}

.tab[aria-selected='true'] {
	background: var(--accent);
	color: var(--on-accent);
	box-shadow: var(--shadow);
}

.path {
	list-style: none;
	margin: 0;
	padding: var(--sp-2) 0;
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
}

/* Zigzag path like a world map. */
.node:nth-child(4n + 2) {
	padding-left: 14%;
}
.node:nth-child(4n + 3) {
	padding-left: 28%;
}
.node:nth-child(4n + 4) {
	padding-left: 14%;
}

.node-btn {
	display: flex;
	align-items: center;
	gap: var(--sp-3);
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	text-align: left;
	cursor: pointer;
}

.node-num {
	flex: none;
	width: 64px;
	height: 64px;
	display: grid;
	place-items: center;
	border: var(--bw) solid var(--line);
	border-radius: var(--r-full);
	background: var(--panel);
	box-shadow: var(--shadow);
	font-size: var(--fs-4);
	font-weight: 800;
}

.node.is-done .node-num {
	background: var(--gold);
	color: var(--line);
}

.node.is-next .node-num {
	background: var(--accent);
	color: var(--on-accent);
	animation: pulse 1.6s ease-in-out infinite;
}

.node.is-locked .node-num {
	background: var(--star-off);
	color: var(--muted);
	box-shadow: none;
	border-style: dashed;
}

.node-info {
	display: flex;
	flex-direction: column;
	line-height: 1.2;
}

.node-title {
	font-weight: 800;
	font-size: var(--fs-3);
}

.node.is-locked .node-title,
.node-locked {
	color: var(--muted);
}

.node-meta {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	min-height: 24px;
	font-size: var(--fs-1);
}

.mini-stars {
	display: inline-flex;
	gap: 1px;
	font-size: 20px;
}

.mini-stars svg {
	fill: var(--star-off);
	stroke: var(--line);
	stroke-width: 1.4;
}

.mini-stars .on svg {
	fill: var(--gold);
}

.grade-chip {
	padding: 0 var(--sp-2);
	border: 2px solid var(--line);
	border-radius: var(--r-1);
	font-weight: 800;
	font-size: var(--fs-1);
	line-height: 1.4;
	color: var(--line);
	background: var(--g-s);
}

.grade-chip.g-SS {
	background: var(--g-ss);
}

.grade-chip.g-SSS {
	background: linear-gradient(90deg, var(--g-sss-a), var(--g-sss-b), var(--g-sss-c));
}

/* ---------- Sheet (dialog) ---------- */

.sheet {
	width: calc(100% - 2 * var(--sp-4));
	max-width: 440px;
	/* Never taller than the screen: long sheets scroll inside. */
	max-height: calc(100dvh - 2 * var(--sp-4) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
	overflow-y: auto;
	overscroll-behavior: contain;
	margin: auto auto calc(var(--sp-4) + env(safe-area-inset-bottom));
	padding: 0;
	border: var(--bw) solid var(--line);
	border-radius: var(--r-3);
	background: var(--panel);
	color: var(--text);
	box-shadow: var(--shadow-lg);
}

.sheet[open] {
	animation: sheet-in 220ms var(--ease-out);
}

.sheet::backdrop {
	background: rgba(20, 16, 30, 0.55);
}

.sheet-body {
	display: flex;
	flex-direction: column;
	gap: var(--sp-4);
	padding: var(--sp-5);
}

.sheet-kicker {
	color: var(--muted);
	font-weight: 700;
	font-size: var(--fs-1);
	margin-bottom: calc(-1 * var(--sp-3));
}

.sheet-title {
	font-size: var(--fs-5);
	line-height: 1.15;
}

.sheet-example {
	color: var(--muted);
}

.sheet-example b {
	color: var(--text);
}

.sheet-actions {
	display: flex;
	justify-content: space-between;
	gap: var(--sp-3);
	/* Stays reachable at the bottom when a long sheet scrolls. */
	position: sticky;
	bottom: 0;
	margin: 0 calc(-1 * var(--sp-5)) calc(-1 * var(--sp-5));
	padding: var(--sp-3) var(--sp-5) var(--sp-5);
	background: var(--panel);
}

.sheet-actions .btn {
	/* Equal halves whatever the label length (long words in some languages). */
	flex: 1 1 0;
	min-width: 0;
	padding-inline: var(--sp-3);
	font-size: var(--fs-2);
	line-height: 1.15;
	overflow-wrap: anywhere;
}

.modes {
	margin: 0;
	padding: 0;
	border: 0;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--sp-3);
}

.modes legend {
	padding: 0;
	margin-bottom: var(--sp-2);
	font-weight: 700;
}

.mode {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: var(--sp-1);
	padding: var(--sp-3);
	border: var(--bw) solid var(--line);
	border-radius: var(--r-2);
	cursor: pointer;
	line-height: 1.25;
}

.mode input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.mode:has(input:checked) {
	background: var(--accent-soft);
	box-shadow: var(--shadow);
}

.mode:has(input:focus-visible) {
	outline: 3px solid var(--info);
	outline-offset: 3px;
}

.mode.is-disabled {
	border-style: dashed;
	cursor: not-allowed;
}

.mode-title {
	display: flex;
	align-items: center;
	gap: var(--sp-1);
	font-weight: 800;
	font-size: var(--fs-3);
}

.mode-text {
	font-size: var(--fs-1);
	color: var(--muted);
}

.mode-best {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
}

.mastery p {
	font-size: var(--fs-1);
}

.meter {
	height: 12px;
	border: 2px solid var(--line);
	border-radius: var(--r-full);
	background: var(--star-off);
	overflow: hidden;
}

.meter i {
	display: block;
	height: 100%;
	background: var(--good);
}

.note {
	padding: var(--sp-3);
	border-radius: var(--r-1);
	background: var(--accent-soft);
	font-size: var(--fs-1);
	font-weight: 700;
}

.locked-msg {
	display: flex;
	gap: var(--sp-2);
	align-items: flex-start;
	font-weight: 700;
}

.locked-msg svg {
	flex: none;
	margin-top: 4px;
}

/* ---------- Play ---------- */

.play-top {
	display: flex;
	align-items: center;
	gap: var(--sp-3);
}

.dots {
	flex: 1;
	display: flex;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.dots li {
	flex: 1;
	height: 12px;
	border: 2px solid var(--line);
	border-radius: var(--r-full);
	background: var(--panel);
	transition: background-color 200ms var(--ease-out);
}

.dots .ok {
	background: var(--good);
}

.dots .ko {
	background: var(--bad);
}

.dots .now {
	background: var(--accent);
}

.points {
	min-width: 72px;
	text-align: right;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.points b {
	font-size: var(--fs-4);
	font-weight: 800;
}

.points span {
	margin-left: 2px;
	font-size: var(--fs-1);
	color: var(--muted);
}

.stage {
	flex: 1;
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: var(--sp-4);
}

.combo {
	position: absolute;
	top: 0;
	right: 0;
	padding: 0 var(--sp-3);
	border: var(--bw) solid var(--line);
	border-radius: var(--r-1);
	background: var(--gold);
	color: var(--line);
	font-weight: 800;
	font-size: var(--fs-3);
	transform: rotate(4deg);
	opacity: 0;
}

.combo.show {
	animation: combo 900ms var(--ease-out) forwards;
}

.qcard {
	position: relative;
	padding: var(--sp-6) var(--sp-4) var(--sp-5);
	border: var(--bw) solid var(--line);
	border-radius: var(--r-3);
	background: var(--panel);
	box-shadow: var(--shadow-lg);
	text-align: center;
	transition: background-color 200ms var(--ease-out);
}

.qcard.is-right {
	background: var(--good-soft);
}

.qcard.is-wrong {
	background: var(--bad-soft);
}

.qcard.enter {
	animation: enter 260ms var(--ease-out);
}

.qcard.pop {
	animation: pop 320ms var(--ease-back);
}

.qcard.shake {
	animation: shake 420ms ease-in-out;
}

.qtag {
	position: absolute;
	top: calc(-1 * var(--sp-3));
	left: 50%;
	transform: translateX(-50%) rotate(-2deg);
	padding: 0 var(--sp-3);
	border: var(--bw) solid var(--line);
	border-radius: var(--r-full);
	font-weight: 800;
	font-size: var(--fs-1);
	white-space: nowrap;
}

.tag-revenge {
	background: var(--accent);
	color: var(--on-accent);
}

.tag-review {
	background: var(--panel);
	color: var(--review);
}

.qtext {
	display: flex;
	justify-content: center;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0 0.3em;
	font-size: clamp(2.4rem, 13vw, var(--fs-6));
	font-weight: 800;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
}

.qtext .op {
	color: var(--accent);
}

.qcard.is-right .qanswer {
	color: var(--good);
}

.qcard.is-wrong .qanswer {
	color: var(--bad);
}

.bonus {
	height: 8px;
	margin-top: var(--sp-4);
	border-radius: var(--r-full);
	background: var(--star-off);
	overflow: hidden;
}

.bonus i {
	display: block;
	height: 100%;
	background: var(--gold);
	transform-origin: left;
}

.bonus i.run {
	animation: drain linear forwards;
}

.float-points {
	position: absolute;
	right: var(--sp-4);
	top: var(--sp-3);
	font-weight: 800;
	font-size: var(--fs-4);
	color: var(--good);
	pointer-events: none;
	animation: float 900ms var(--ease-out) forwards;
}

.feedback {
	min-height: 3em;
	text-align: center;
	font-weight: 700;
	font-size: var(--fs-3);
	line-height: 1.25;
}

.feedback.is-right {
	color: var(--good);
}

.feedback.is-wrong {
	color: var(--bad);
	font-size: var(--fs-2);
}

.answers-qcm {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--sp-3);
}

.choice {
	min-height: 84px;
	border: var(--bw) solid var(--line);
	border-radius: var(--r-2);
	background: var(--panel);
	box-shadow: var(--shadow);
	font-size: var(--fs-5);
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	cursor: pointer;
	touch-action: manipulation;
	transition: transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out), background-color 150ms;
}

.choice:disabled {
	cursor: default;
}

.choice.is-right {
	background: var(--good);
	color: var(--line);
	animation: pop 320ms var(--ease-back);
}

.choice.is-wrong {
	background: var(--bad);
	color: #fff;
	animation: shake 420ms ease-in-out;
}

.choice:disabled:not(.is-right):not(.is-wrong) {
	opacity: 0.45;
}

.answers-pad {
	display: flex;
	flex-direction: column;
	gap: var(--sp-3);
}

.pad-display {
	display: block;
	min-height: 64px;
	padding: var(--sp-2);
	border: var(--bw) solid var(--line);
	border-radius: var(--r-2);
	background: var(--panel);
	text-align: center;
	font-size: var(--fs-5);
	font-weight: 800;
	line-height: 1.4;
	font-variant-numeric: tabular-nums;
}

.pad-display.is-empty {
	color: var(--muted);
	font-size: var(--fs-3);
	line-height: 2.2;
}

.pad-display.is-right {
	background: var(--good-soft);
}

.pad-display.is-wrong {
	background: var(--bad-soft);
}

.keypad {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--sp-2);
}

.key {
	min-height: 60px;
	display: grid;
	place-items: center;
	border: var(--bw) solid var(--line);
	border-radius: var(--r-2);
	background: var(--panel);
	box-shadow: var(--shadow-sm);
	font-size: var(--fs-4);
	font-weight: 800;
	cursor: pointer;
	touch-action: manipulation;
}

.key-ok {
	background: var(--accent);
	color: var(--on-accent);
}

.key-ok:disabled {
	background: var(--star-off);
	color: var(--muted);
	cursor: not-allowed;
}

/* ---------- Results ---------- */

.results {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--sp-4);
	text-align: center;
	padding-top: var(--sp-4);
}

.res-title {
	font-size: var(--fs-5);
	line-height: 1.1;
}

.res-stars {
	display: flex;
	gap: var(--sp-2);
	font-size: 72px;
}

.rstar:nth-child(2) {
	transform: translateY(-14px);
	font-size: 1.15em;
}

.rstar svg {
	fill: var(--star-off);
	stroke: var(--line);
	stroke-width: 1.2;
}

.rstar.on svg {
	fill: var(--gold);
	animation: star-in 520ms var(--ease-back) backwards;
	animation-delay: var(--delay);
}

.stamp {
	position: relative;
	width: 132px;
	height: 132px;
	display: grid;
	place-items: center;
	animation: stamp 520ms var(--ease-back) 900ms backwards;
}

/* Manga speed lines behind the grade. */
.stamp::before {
	content: '';
	position: absolute;
	inset: -40px;
	border-radius: 50%;
	background: repeating-conic-gradient(var(--grade-color) 0 6deg, transparent 6deg 18deg);
	mask: radial-gradient(circle, transparent 38%, #000 40%, transparent 72%);
	opacity: 0.6;
	animation: spin 12s linear infinite;
}

.stamp span {
	position: relative;
	padding: 0 var(--sp-3);
	border: 5px solid var(--line);
	border-radius: var(--r-2);
	background: var(--grade-color);
	color: var(--line);
	box-shadow: var(--shadow-lg);
	font-size: var(--fs-7);
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -0.04em;
	transform: rotate(-8deg);
}

.stamp.g-S {
	--grade-color: var(--g-s);
}

.stamp.g-SS {
	--grade-color: var(--g-ss);
}

.stamp.g-SSS {
	--grade-color: var(--g-sss-b);
}

.stamp.g-SSS span {
	font-size: var(--fs-6);
	padding: var(--sp-2) var(--sp-3);
	background: linear-gradient(110deg, var(--g-sss-a), var(--g-sss-b), var(--g-sss-c), var(--g-sss-a));
	background-size: 300% 100%;
	animation: shine 3s linear infinite;
}

.badge-new,
.res-unlock {
	padding: var(--sp-1) var(--sp-3);
	border: var(--bw) solid var(--line);
	border-radius: var(--r-full);
	background: var(--gold);
	color: var(--line);
	font-weight: 800;
}

.res-unlock {
	background: var(--good-soft);
	color: var(--text);
	font-weight: 700;
}

.res-stats {
	width: 100%;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--sp-2);
	margin: 0;
}

.res-stats div {
	padding: var(--sp-2);
	border: var(--bw) solid var(--line);
	border-radius: var(--r-2);
	background: var(--panel);
}

.res-stats dt {
	font-size: var(--fs-1);
	color: var(--muted);
}

.res-stats dd {
	margin: 0;
	font-size: var(--fs-4);
	font-weight: 800;
	line-height: 1.2;
	font-variant-numeric: tabular-nums;
}

.res-hint {
	font-weight: 700;
}

.res-missed {
	width: 100%;
	padding: var(--sp-3) var(--sp-4);
	border: var(--bw) solid var(--line);
	border-radius: var(--r-2);
	background: var(--panel);
	text-align: left;
}

.res-missed h2 {
	font-size: var(--fs-3);
}

.res-missed ul {
	margin: var(--sp-1) 0 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-1) var(--sp-4);
	font-size: var(--fs-3);
	font-variant-numeric: tabular-nums;
}

.res-missed b {
	color: var(--good);
}

.noscript {
	padding: var(--sp-5);
	text-align: center;
}

/* ---------- Animations ---------- */

@keyframes pulse {
	50% {
		box-shadow: var(--shadow), 0 0 0 8px rgba(255, 107, 26, 0.3);
	}
}

@keyframes sheet-in {
	from {
		transform: translateY(24px);
		opacity: 0;
	}
}

@keyframes enter {
	from {
		transform: translateX(40px) rotate(2deg);
		opacity: 0;
	}
}

@keyframes pop {
	40% {
		transform: scale(1.06);
	}
}

@keyframes shake {
	20%,
	60% {
		transform: translateX(-8px);
	}
	40%,
	80% {
		transform: translateX(8px);
	}
}

@keyframes drain {
	from {
		transform: scaleX(1);
	}
	to {
		transform: scaleX(0);
	}
}

@keyframes float {
	from {
		transform: translateY(0);
		opacity: 1;
	}
	to {
		transform: translateY(-48px);
		opacity: 0;
	}
}

@keyframes combo {
	0% {
		opacity: 0;
		transform: scale(0.4) rotate(-10deg);
	}
	25% {
		opacity: 1;
		transform: scale(1.15) rotate(4deg);
	}
	75% {
		opacity: 1;
		transform: scale(1) rotate(4deg);
	}
	100% {
		opacity: 0;
		transform: scale(1) rotate(4deg);
	}
}

@keyframes star-in {
	from {
		transform: scale(0) rotate(-120deg);
	}
}

@keyframes stamp {
	from {
		transform: scale(3) rotate(-20deg);
		opacity: 0;
	}
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

@keyframes shine {
	to {
		background-position: 300% 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 1ms !important;
		animation-iteration-count: 1 !important;
		animation-delay: 0ms !important;
		transition-duration: 1ms !important;
	}
	.bonus i.run {
		animation: none;
	}
}

.head-actions {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
}

a.icon-btn {
	color: var(--text);
}

/* Screens with the keypad must fit the screen height: the submit key is on
   the last row and must always be visible. */
.app-play:has(.answers-pad) {
	height: 100vh;
	height: 100dvh;
	min-height: 0;
	overflow: hidden;
}

.app-play:has(.answers-pad) .stage {
	min-height: 0;
}

.answers-pad .keypad .key {
	min-height: 0;
	height: clamp(44px, 7.5dvh, 60px);
}

@media (max-height: 760px) {
	.app-play:has(.answers-pad) {
		gap: var(--sp-2);
		padding-top: calc(var(--sp-2) + env(safe-area-inset-top));
		padding-bottom: calc(var(--sp-2) + env(safe-area-inset-bottom));
	}
	.app-play:has(.answers-pad) .qcard {
		padding: var(--sp-4) var(--sp-3) var(--sp-3);
	}
	.app-play:has(.answers-pad) .qtext {
		font-size: clamp(2rem, 10vw, 2.6rem);
	}
	.answers-pad .pad-display {
		min-height: 48px;
		line-height: 1.3;
		font-size: var(--fs-4);
	}
	.answers-pad .pad-display.is-empty {
		line-height: 2;
		font-size: var(--fs-2);
	}
	.answers-pad .keypad {
		gap: 6px;
	}
}

.settings-group {
	margin: 0;
	padding: 0;
	border: 0;
	display: grid;
	gap: var(--sp-2);
}

.settings-group legend {
	padding: 0;
	margin-bottom: var(--sp-2);
	font-weight: 800;
}

.settings-options {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--sp-2);
}

.settings-options.is-3 {
	grid-template-columns: repeat(3, 1fr);
}

.settings-options .btn {
	min-width: 0;
	padding-inline: var(--sp-2);
	font-size: var(--fs-2);
}

.settings-hint {
	font-size: var(--fs-1);
	color: var(--muted);
}

/* ---------- About page ---------- */

.head-spacer {
	width: 44px;
}

.about-card {
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);
	padding: var(--sp-4);
	border: var(--bw) solid var(--line);
	border-radius: var(--r-2);
	background: var(--panel);
	box-shadow: var(--shadow);
}

.about-card h2 {
	font-size: var(--fs-3);
	line-height: 1.2;
}

.about-story {
	background: var(--accent-soft);
}

.about-card a {
	color: inherit;
	font-weight: 700;
	text-underline-offset: 3px;
}

.about-list {
	margin: 0;
	padding-left: 1.2em;
	display: grid;
	gap: var(--sp-1);
}

.legal-list,
.legal-rows {
	margin: 0;
	display: grid;
	gap: var(--sp-3);
}

.legal-rows {
	gap: 0;
	margin-top: var(--sp-1);
	font-size: var(--fs-1);
}

.legal-list dt {
	font-size: var(--fs-1);
	font-weight: 800;
	color: var(--muted);
}

.legal-rows dt {
	display: inline;
	font-weight: 700;
}

.legal-rows dt::after {
	content: ' : ';
}

.legal-rows dd {
	display: inline;
}

.legal-list dd {
	margin: 0;
}

.legal-sub {
	display: block;
	font-size: var(--fs-1);
	color: var(--muted);
}

.legal-updated {
	font-size: var(--fs-1);
	color: var(--muted);
}

.site-footer {
	text-align: center;
	font-size: var(--fs-1);
}

.site-footer a {
	color: var(--muted);
	text-underline-offset: 3px;
}
