/* ==========================================================================
   Bean Arcade. Black and white: paper and ink, nothing else unless a game
   needs a team colour. The canvas always draws ink on white; dark mode
   inverts it, so every game gets a dark version for free.
   ========================================================================== */

@font-face {
	font-family: "Jura";
	font-style: normal;
	font-weight: 300 700;
	font-display: swap;
	src: url("fonts/jura-var-latin.woff2") format("woff2");
}

:root {
	--paper: #ffffff;
	--ink: #111111;
	--mute: #6b6b6b;
	--line: #e4e4e4;
	--veil: rgba(255, 255, 255, 0.86);
	--font: "Jura", system-ui, -apple-system, "Segoe UI", sans-serif;
	--ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	color-scheme: light;
}

:root[data-theme="dark"] {
	--paper: #0b0b0b;
	--ink: #f2f2f2;
	--mute: #9a9a9a;
	--line: #262626;
	--veil: rgba(11, 11, 11, 0.86);
	color-scheme: dark;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

/* Pills and tools set their own display, which would beat the hidden attribute. */
[hidden] {
	display: none !important;
}

html,
body {
	height: 100%;
}

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.5;
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
	transition: background-color 0.4s ease, color 0.4s ease;
}

button {
	font: inherit;
	color: inherit;
}

.icon {
	width: 1em;
	height: 1em;
	flex: none;
}

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

.skip-link {
	position: absolute;
	top: -100px;
	left: 16px;
	z-index: 100;
	padding: 8px 14px;
	background: var(--ink);
	color: var(--paper);
	text-decoration: none;
}

.skip-link:focus {
	top: 12px;
}

/* Top bar ------------------------------------------------------------------ */
.arcade-bar {
	position: fixed;
	inset: 0 0 auto;
	z-index: 30;
	display: flex;
	align-items: center;
	gap: 16px;
	height: 64px;
	padding: 0 clamp(14px, 3vw, 28px);
	pointer-events: none;
}

.arcade-bar > * {
	pointer-events: auto;
}

.bar-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--ink);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-size: 0.82rem;
	text-decoration: none;
}

.bar-link .icon {
	font-size: 1.2rem;
}

/* Left, after the Mad Beans link, like the next step of a breadcrumb. */
.bar-title {
	margin: 0 auto 0 0;
	font-weight: 700;
	letter-spacing: 0.32em;
	text-transform: uppercase;
	font-size: 0.82rem;
}

.bar-tools {
	display: flex;
	gap: 6px;
}

.tool {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 40px;
	height: 40px;
	padding: 0 10px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--paper);
	font-size: 1.05rem;
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.4s ease;
}

.tool:hover {
	border-color: var(--ink);
}

.tool-label {
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.tool[aria-pressed="true"] .when-off,
.tool[aria-pressed="false"] .when-on,
:root[data-theme="dark"] .when-light,
:root:not([data-theme="dark"]) .when-dark {
	display: none;
}

.tool > span {
	display: inline-flex;
}

/* Stage -------------------------------------------------------------------- */
.stage {
	position: fixed;
	inset: 0;
	touch-action: none;
	cursor: crosshair;
	transition: filter 0.4s ease, opacity 0.5s ease;
}

.stage canvas {
	display: block;
}

/* Dark mode inverts the intro canvas. Turning the hue back round keeps a
   coloured ink its own colour. */
:root[data-theme="dark"] .stage {
	filter: invert(1) hue-rotate(180deg);
}

.is-picking .stage {
	opacity: 0.35;
}

/* Intro overlay ----------------------------------------------------------- */
.intro {
	position: fixed;
	inset: 0;
	z-index: 10;
	pointer-events: none;
	transition: opacity 0.4s ease;
}

.is-picking .intro,
.is-result .intro {
	opacity: 0;
}

.intro-kicker {
	position: absolute;
	top: 78px;
	left: 50%;
	margin: 0;
	transform: translateX(-50%);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.4em;
	text-transform: uppercase;
	white-space: nowrap;
	animation: fade-in 1.2s var(--ease) both 0.3s;
}

.intro-hint {
	position: absolute;
	left: 50%;
	bottom: 96px;
	width: min(90vw, 460px);
	margin: 0;
	transform: translateX(-50%);
	text-align: center;
	color: var(--mute);
	font-size: 0.95rem;
	transition: opacity 0.6s ease;
	animation: fade-in 1.2s var(--ease) both 0.8s;
}

.intro-hint.is-gone {
	opacity: 0;
}

.hud {
	position: absolute;
	left: 50%;
	bottom: 36px;
	display: flex;
	align-items: center;
	gap: 18px;
	transform: translateX(-50%);
	animation: fade-in 1.2s var(--ease) both 1s;
}

.ink {
	position: relative;
	width: clamp(120px, 22vw, 220px);
	height: 3px;
	background: var(--line);
	overflow: hidden;
}

.ink-bar {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	background: var(--ink);
	transition: width 0.35s var(--ease);
}

.ink-label {
	min-width: 76px;
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-variant-numeric: tabular-nums;
}

.ammo {
	display: flex;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ammo li {
	width: 16px;
	height: 16px;
	background: var(--ink);
	-webkit-mask: url("images/bean-white.png") center / contain no-repeat;
	mask: url("images/bean-white.png") center / contain no-repeat;
	transition: opacity 0.3s ease, transform 0.3s var(--ease);
}

.ammo li.is-used {
	opacity: 0.15;
	transform: scale(0.8);
}

.ammo li.is-new {
	animation: pop 0.5s var(--ease);
}

/* Bottom left: the feedback button holds the bottom right corner. */
.intro-skip {
	position: absolute;
	left: clamp(14px, 3vw, 28px);
	bottom: 30px;
	pointer-events: auto;
	animation: fade-in 1.2s var(--ease) both 1.4s;
}

.text-button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 4px;
	border: 0;
	background: none;
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
	border-bottom: 1px solid transparent;
}

.text-button:hover {
	border-bottom-color: var(--ink);
}

/* Pills -------------------------------------------------------------------- */
.pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 20px;
	border: 1.5px solid var(--ink);
	border-radius: 999px;
	background: transparent;
	color: var(--ink);
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s var(--ease);
}

.pill-solid,
.pill:hover {
	background: var(--ink);
	color: var(--paper);
}

.pill .icon {
	transition: transform 0.2s var(--ease);
}

/* Result card ------------------------------------------------------------- */
.result {
	position: fixed;
	left: 50%;
	bottom: clamp(24px, 8vh, 80px);
	z-index: 15;
	width: min(92vw, 420px);
	padding: 26px 28px;
	transform: translateX(-50%);
	border: 1px solid var(--ink);
	background: var(--veil);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	text-align: center;
	animation: rise 0.6s var(--ease) both;
}

.result[hidden] {
	display: none;
}

.result-title {
	margin: 0 0 6px;
	font-size: 1.9rem;
	font-weight: 300;
	letter-spacing: 0.04em;
}

.result-text {
	margin: 0 0 18px;
	color: var(--mute);
}

.result-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
}

/* Game picker -------------------------------------------------------------- */
.picker {
	position: fixed;
	inset: 0;
	z-index: 20;
	overflow-y: auto;
	padding: 96px clamp(16px, 4vw, 40px) 48px;
	background: var(--veil);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	animation: fade-in 0.4s ease both;
}

.picker[hidden] {
	display: none;
}

.picker-inner {
	max-width: 980px;
	margin: 0 auto;
}

.picker-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 28px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--ink);
}

.picker-title {
	margin: 0;
	font-size: clamp(2rem, 5vw, 3rem);
	font-weight: 300;
	letter-spacing: 0.04em;
}

.games {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
	gap: 18px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.game {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding: 26px 24px 24px;
	border: 1px solid var(--line);
	background: var(--paper);
	transition: border-color 0.2s ease, transform 0.3s var(--ease), background-color 0.4s ease;
	animation: rise 0.6s var(--ease) both;
}

.game:nth-child(2) {
	animation-delay: 0.08s;
}

.game:nth-child(3) {
	animation-delay: 0.16s;
}

.game:hover {
	border-color: var(--ink);
}

.game-logo {
	height: 40px;
	width: auto;
	margin-bottom: 18px;
}

:root[data-theme="dark"] .game-logo {
	filter: invert(1);
}

.game-title {
	margin: 0 0 6px;
	font-size: 1.4rem;
	font-weight: 600;
	letter-spacing: 0.04em;
}

.game-tagline {
	margin: 0 0 8px;
}

.game-how,
.game-status {
	margin: 0 0 8px;
	color: var(--mute);
	font-size: 0.88rem;
}

.game-status {
	margin-bottom: 20px;
	font-size: 0.74rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.game .pill {
	margin-top: auto;
}

.game-soon {
	border-style: dashed;
	justify-content: center;
}

.game-soon:hover {
	transform: none;
	border-color: var(--line);
}

/* Game host ---------------------------------------------------------------- */
.host {
	position: fixed;
	inset: 0;
	z-index: 40;
	background: #fff;
}

.host[hidden] {
	display: none;
}

.host-frame {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

.host-close {
	position: absolute;
	top: 14px;
	left: 14px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 16px 0 12px;
	border: 1.5px solid #111;
	border-radius: 999px;
	background: #fff;
	color: #111;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
}

.host-close:hover {
	background: #111;
	color: #fff;
}

.noscript {
	position: fixed;
	inset: 40% 16px auto;
	text-align: center;
}

/* Motion ------------------------------------------------------------------- */
@keyframes fade-in {
	from {
		opacity: 0;
	}
}

@keyframes rise {
	from {
		opacity: 0;
		transform: translate(var(--tx, 0), 16px);
	}
}

.result {
	--tx: -50%;
}

@keyframes pop {
	0% {
		transform: scale(0.2);
	}
	60% {
		transform: scale(1.4);
	}
	100% {
		transform: scale(1);
	}
}

@media (max-width: 600px) {
	/* Hidden from sight, still read out, so icon-only tools keep their names. */
	.tool-label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
	}

	.bar-link span,
	.bar-title {
		display: none;
	}

	.bar-tools {
		margin-left: auto;
	}

	.hud {
		width: calc(100vw - 32px);
		gap: 12px;
		justify-content: center;
	}

	.ink {
		flex: 1;
		max-width: 140px;
	}

	.ink-label {
		min-width: 0;
		white-space: nowrap;
	}

	.ammo {
		gap: 4px;
	}

	.ammo li {
		width: 13px;
		height: 13px;
	}

	.intro-hint {
		bottom: 110px;
	}

	.hud {
		bottom: 64px;
	}

	.intro-skip {
		left: 50%;
		right: auto;
		bottom: 14px;
		transform: translateX(-50%);
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}

/* Native games ------------------------------------------------------------- */
/* They draw their own dark palette, so the intro's invert must not touch them. */
.is-playing .stage,
:root[data-theme] .is-playing .stage {
	filter: none;
	cursor: default;
	opacity: 1;
}

.is-playing .intro,
.is-playing .result,
.is-playing .picker {
	display: none;
}

.is-playing .bar-title {
	opacity: 0;
}

.panel {
	position: fixed;
	left: 50%;
	top: 50%;
	z-index: 25;
	width: min(92vw, 440px);
	/* Clear of the top bar, and scrolls when it is taller than the window
	   (the end panel with the sign-up form is, on a laptop 720 high). */
	max-height: calc(100vh - 150px);
	max-height: calc(100dvh - 150px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 28px;
	transform: translate(-50%, -50%);
	border: 1px solid var(--ink);
	background: var(--veil);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	text-align: center;
	animation: pop-in 0.35s var(--ease) both;
}

.panel[hidden] {
	display: none;
}

.is-paused .stage,
.is-over .stage {
	opacity: 0.45;
}

.over-score {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin: 6px 0 8px;
}

.over-label {
	color: var(--mute);
	font-size: 0.74rem;
	font-weight: 700;
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

.over-score strong {
	font-size: 3rem;
	font-weight: 300;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
}

.game-best {
	margin: -12px 0 18px;
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.06em;
}

.game-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px;
	margin-top: auto;
}

.game-actions .text-button {
	color: var(--mute);
}

@keyframes pop-in {
	from {
		opacity: 0;
		transform: translate(-50%, -46%) scale(0.96);
	}
}

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

/* Beans in the bar ----------------------------------------------------------- */
.tool-beans {
	gap: 6px;
	padding: 0 14px 0 12px;
}

.tool-count {
	font-size: 0.86rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
}

.tool-beans.is-bump {
	animation: bump 0.7s var(--ease);
}

@keyframes bump {
	30% {
		transform: scale(1.18);
		background: var(--ink);
		color: var(--paper);
	}
}

.result-beans {
	margin: -8px 0 16px;
	font-weight: 700;
	letter-spacing: 0.06em;
}

/* Picker extras --------------------------------------------------------------- */
.game-meta {
	margin: -12px 0 18px;
	color: var(--mute);
	font-size: 0.8rem;
}

.boards {
	margin-top: 48px;
	padding-top: 20px;
	border-top: 1px solid var(--ink);
}

.boards-title {
	margin: 0 0 14px;
	font-size: clamp(1.5rem, 3.4vw, 2rem);
	font-weight: 300;
	letter-spacing: 0.04em;
}

.board-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 14px;
}

.board-tab {
	min-height: 36px;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--paper);
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
}

.board-tab:hover {
	border-color: var(--ink);
}

.board-tab[aria-pressed="true"] {
	border-color: var(--ink);
	background: var(--ink);
	color: var(--paper);
}

.board {
	max-width: 560px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.board[aria-busy="true"] {
	opacity: 0.5;
}

.board-row {
	display: grid;
	grid-template-columns: 3.2em 1fr auto;
	align-items: baseline;
	gap: 10px;
	padding: 9px 4px;
	border-bottom: 1px solid var(--line);
	font-variant-numeric: tabular-nums;
}

.board-row:first-child {
	font-size: 1.12rem;
}

.board-rank {
	color: var(--mute);
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.06em;
}

.board-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 600;
}

.board-row.is-you {
	background: var(--ink);
	color: var(--paper);
}

.board-row.is-you .board-rank {
	color: inherit;
}

.board-empty,
.board-note {
	padding: 10px 4px;
	color: var(--mute);
	font-size: 0.9rem;
}

/* Bean shop -------------------------------------------------------------------- */
.shop {
	position: fixed;
	inset: 0;
	z-index: 28;
	overflow-y: auto;
	padding: 96px clamp(16px, 4vw, 40px) 48px;
	background: var(--veil);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	animation: fade-in 0.3s ease both;
}

.shop[hidden] {
	display: none;
}

.is-shopping .stage {
	opacity: 0.35;
}

.shop-inner {
	max-width: 980px;
	margin: 0 auto;
}

.shop-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--ink);
}

.shop-title {
	margin: 0;
	font-size: clamp(2rem, 5vw, 3rem);
	font-weight: 300;
	letter-spacing: 0.04em;
}

.shop-beans {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 4px 0 0;
	font-size: 1.1rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.shop-intro {
	max-width: 620px;
	margin: 16px 0 4px;
	color: var(--mute);
}

.shop-msg {
	min-height: 1.5em;
	margin: 0 0 8px;
	font-weight: 700;
}

.shop-group {
	margin-top: 22px;
}

.shop-group-title {
	margin: 0 0 12px;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

.shop-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.shop-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 12px 10px 14px;
	border: 1px solid var(--line);
	background: var(--paper);
	text-align: center;
	transition: border-color 0.2s ease, transform 0.25s var(--ease);
}

.shop-item:hover {
	border-color: var(--ink);
}

.shop-item.is-worn {
	border-color: var(--ink);
	box-shadow: inset 0 0 0 1px var(--ink);
}

.shop-preview {
	display: block;
	max-width: 100%;
	height: auto;
}

.shop-name {
	margin: 6px 0 2px;
	font-weight: 600;
}

.shop-price {
	margin: 0 0 8px;
	color: var(--mute);
	font-size: 0.82rem;
}

.shop-button {
	min-height: 36px;
	margin-top: auto;
	padding: 0 14px;
	font-size: 0.72rem;
}

.shop-item.is-owned .shop-button {
	margin-top: 8px;
}

.shop-button:disabled {
	border-color: var(--line);
	background: transparent;
	color: var(--mute);
	cursor: default;
	transform: none;
}

/* Names ------------------------------------------------------------------------ */
.account {
	max-width: 560px;
	margin-top: 40px;
	padding-top: 20px;
	border-top: 1px solid var(--ink);
}

.join {
	margin-top: 12px;
	text-align: left;
}

.join-row {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 0 0 12px;
}

.join-row label {
	font-size: 0.74rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.join-row input {
	min-height: 44px;
	padding: 0 12px;
	border: 1px solid var(--ink);
	border-radius: 0;
	background: var(--paper);
	color: var(--ink);
	font: inherit;
}

.join-note {
	margin: 0 0 12px;
	color: var(--mute);
	font-size: 0.84rem;
}

.join-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.join-msg {
	min-height: 1.5em;
	margin: 10px 0 0;
	font-weight: 700;
}

.join-msg.is-error {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

.forget {
	margin-top: 22px;
	color: var(--mute);
}

.forget summary {
	cursor: pointer;
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.08em;
}

.forget form {
	margin-top: 12px;
	color: var(--ink);
}

/* End of a game ------------------------------------------------------------------ */
.panel-over {
	top: calc(50% + 30px);
	width: min(94vw, 480px);
	max-height: calc(100vh - 84px);
	max-height: calc(100dvh - 84px);
	overflow-y: auto;
	padding: 26px 24px 18px;
}

.over-best {
	margin: 0 0 10px;
	color: var(--mute);
}

.over-beans {
	margin: 0 0 6px;
	font-weight: 700;
	letter-spacing: 0.06em;
}

.over-beans.is-waiting {
	color: var(--mute);
	font-weight: 400;
}

.over-place {
	margin: 0 0 6px;
	font-weight: 600;
}

.over-join {
	margin: 14px 0 6px;
	padding: 16px 16px 6px;
	border: 1px dashed var(--ink);
}

.over-join-title {
	margin: 0;
	font-weight: 600;
}

.rate-box {
	margin: 16px 0 6px;
	padding-top: 14px;
	border-top: 1px solid var(--line);
}

.rate {
	display: flex;
	justify-content: center;
	gap: 4px;
	margin-top: 6px;
}

.rate-bean {
	display: inline-flex;
	padding: 6px;
	border: 0;
	border-radius: 999px;
	background: none;
	font-size: 1.7rem;
	cursor: pointer;
	transition: transform 0.2s var(--ease);
}

.rate-bean:hover {
	color: var(--ink);
	opacity: 1;
}

.rate-bean.is-on svg {
	fill: currentColor;
}

.rate-msg {
	min-height: 1.4em;
	margin: 2px 0 0;
	color: var(--mute);
	font-size: 0.84rem;
}

.over-next {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin: 14px 0;
}

.over-next [hidden] {
	display: none;
}

.offer {
	display: flex;
	gap: 14px;
	align-items: center;
	padding: 12px;
	border: 1px solid var(--ink);
	color: inherit;
	text-align: left;
	text-decoration: none;
	transition: transform 0.25s var(--ease);
}

.offer[hidden] {
	display: none;
}

.offer:hover {
	border-color: var(--ink);
}

.offer-image {
	flex: none;
	width: 84px;
	height: 84px;
	object-fit: cover;
	background: var(--line);
}

.offer-image[hidden] {
	display: none;
}

.offer-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.offer-title {
	font-size: 1.1rem;
}

.offer-text {
	color: var(--mute);
	font-size: 0.86rem;
	line-height: 1.4;
}

.offer-cta {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-top: 4px;
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.offer-cta .icon {
	transition: transform 0.2s var(--ease);
}

.over-quit {
	margin-top: 10px;
	color: var(--mute);
}

@media (max-width: 600px) {
	.tool-beans {
		padding: 0 10px;
	}

	.panel-over {
		padding: 22px 16px 14px;
	}

	.offer-image {
		width: 64px;
		height: 64px;
	}

	.shop-list {
		grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
	}
}

/* Round 3: loading, picker on one screen, wordmarks, feedback, reviews ------ */

/* A plain screen with a breathing bean until the intro is ready, so nothing
   half-loaded (fonts, overlay text) ever shows. */
.loader {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: grid;
	place-items: center;
	background: var(--paper);
	transition: opacity 0.6s ease, visibility 0.6s ease;
}

body:not(.is-loading) .loader {
	opacity: 0;
	visibility: hidden;
}

.loader-bean {
	font-size: 3.4rem;
	animation: loader-breathe 1.4s ease-in-out infinite;
}

.loader-bean svg {
	fill: currentColor;
}

@keyframes loader-breathe {
	50% {
		transform: scale(1.12) rotate(-6deg);
		opacity: 0.55;
	}
}

.is-loading .arcade-bar,
.is-loading .intro {
	opacity: 0;
}

.arcade-bar,
.intro {
	transition: opacity 0.6s ease 0.1s;
}

/* A thin line under the title, solid at the left and fading away to the
   right, and a short divider between it and the Mad Beans link. */
.bar-title {
	position: relative;
	padding: 7px 0 7px 17px;
}

.bar-title::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	width: 1px;
	height: 18px;
	margin-top: -9px;
	background: currentColor;
	opacity: 0.3;
}

.bar-title::after {
	content: "";
	position: absolute;
	left: 17px;
	right: -70%;
	bottom: 0;
	height: 1px;
	background: linear-gradient(90deg, currentColor, currentColor 25%, transparent);
	opacity: 0.55;
}

/* The bean count: a bigger, solid bean so it reads as one. */
.tool-beans .icon {
	width: 1.5em;
	height: 1.5em;
	fill: currentColor;
	stroke-width: 1.4;
}

/* Team colours in titles. */
.team-blue {
	color: #2f6fe4;
}

.team-red {
	color: #e5373a;
}

:root[data-theme="dark"] .team-blue {
	color: #5b93ff;
}

:root[data-theme="dark"] .team-red {
	color: #ff5d61;
}

/* The picker: games and high scores side by side, sized to fit one screen. */
.picker {
	padding-top: 84px;
	padding-bottom: 24px;
}

.picker-inner {
	max-width: 1240px;
}

.picker-head {
	margin-bottom: 18px;
	padding-bottom: 12px;
}

.picker-title {
	font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.picker-body {
	display: grid;
	gap: 22px;
}

@media (min-width: 1000px) {
	.picker-body {
		grid-template-columns: minmax(0, 1fr) 320px;
		align-items: start;
	}

	.picker-body .games {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.picker-body .boards {
		margin-top: 0;
		padding: 18px 20px 14px;
		border: 1px solid var(--line);
		border-top: 1px solid var(--ink);
		background: var(--paper);
	}

	.picker-body .board-row {
		padding: 6px 2px;
	}
}

.game {
	padding: 22px 20px 20px;
}

/* Each game's wordmark, set like its logo: one heavy part, one light. */
.game-mark {
	margin: 0 0 12px;
	font-size: clamp(1.7rem, 2.6vw, 2.15rem);
	line-height: 1;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.mark-heavy {
	font-weight: 700;
}

.mark-light {
	font-weight: 300;
}

.game-tagline {
	font-size: 0.94rem;
	line-height: 1.45;
}

.game-status {
	margin-bottom: 12px;
}

.game-best {
	margin: -4px 0 12px;
}

.game-meta {
	margin: -6px 0 12px;
}

.game-soon .game-mark {
	opacity: 0.85;
}

/* An on/off switch, for game options such as power-ups. */
.switch {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 14px;
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
}

.switch input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.switch-track {
	position: relative;
	width: 36px;
	height: 20px;
	border: 1.5px solid var(--ink);
	border-radius: 999px;
	transition: background-color 0.2s ease;
}

.switch-track::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: var(--ink);
	transition: transform 0.2s var(--ease), background-color 0.2s ease;
}

.switch input:checked + .switch-track {
	background: var(--ink);
}

.switch input:checked + .switch-track::after {
	transform: translateX(16px);
	background: var(--paper);
}

.switch input:focus-visible + .switch-track {
	outline: 2px solid var(--ink);
	outline-offset: 3px;
}

/* After rating: a box for a few words. */
.review-box {
	margin: 4px 0 10px;
	text-align: left;
}

.review-box textarea,
.feedback textarea {
	display: block;
	width: 100%;
	margin: 6px 0 10px;
	padding: 10px 12px;
	border: 1px solid var(--ink);
	border-radius: 0;
	background: var(--paper);
	color: var(--ink);
	font: inherit;
	resize: vertical;
}

/* The Mad Beans game card at the end of a game: a bigger picture. */
.offer {
	align-items: stretch;
	padding: 0;
	overflow: hidden;
}

.offer-image {
	width: 140px;
	height: auto;
	min-height: 140px;
}

.offer-body {
	padding: 14px 14px 14px 0;
	justify-content: center;
}

/* Feedback, always there, bottom right. */
.feedback-open {
	position: fixed;
	right: clamp(14px, 3vw, 28px);
	bottom: 18px;
	z-index: 35;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 16px 0 12px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--paper);
	color: var(--ink);
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
	transition: border-color 0.2s ease, transform 0.2s var(--ease);
}

.feedback-open:hover {
	border-color: var(--ink);
}

.feedback-open .icon {
	font-size: 1.1rem;
}

.is-loading .feedback-open {
	opacity: 0;
}

/* Out of the way while a game is on (it sat over game controls on narrower
   screens). Pausing or the end of a game brings it back. */
.is-playing:not(.is-paused):not(.is-over) .feedback-open {
	display: none;
}

.feedback {
	position: fixed;
	right: clamp(14px, 3vw, 28px);
	bottom: 70px;
	z-index: 36;
	width: min(92vw, 380px);
	padding: 18px 18px 12px;
	border: 1px solid var(--ink);
	background: var(--veil);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	animation: rise 0.35s var(--ease) both;
}

.feedback-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.feedback-title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
}

.feedback-close {
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border: 0;
	background: none;
	font-size: 1.1rem;
	cursor: pointer;
}

.feedback-intro {
	margin: 6px 0 0;
	color: var(--mute);
	font-size: 0.88rem;
}

@media (max-width: 600px) {
	.feedback-open span {
		display: none;
	}

	.feedback-open {
		width: 40px;
		padding: 0;
		justify-content: center;
		bottom: 14px;
	}

	.offer-image {
		width: 96px;
		min-height: 96px;
	}

	.game-mark {
		font-size: 1.8rem;
	}
}

/* Round 4: the outline bean, drawn in the text colour from the bean image. -- */
.bean-mark {
	display: inline-block;
	flex: none;
	width: 1.7em;
	height: 1.7em;
	background: currentColor;
	-webkit-mask: url("images/bean-white.png") center / contain no-repeat;
	mask: url("images/bean-white.png") center / contain no-repeat;
}

.tool-beans .bean-mark {
	width: 1.9em;
	height: 1.9em;
	margin: -4px -2px;
}

.shop-beans .bean-mark {
	width: 1.6em;
	height: 1.6em;
}

/* The loader: the outline bean bobbing and turning above "Loading the beans". */
.loader {
	gap: 14px;
	align-content: center;
	color: var(--ink);
}

.loader .loader-bean {
	width: 96px;
	height: 96px;
	font-size: 1rem;
	animation: loader-bob 1.3s ease-in-out infinite;
}

@keyframes loader-bob {
	0%, 100% { transform: translateY(0) rotate(-8deg); }
	50% { transform: translateY(-14px) rotate(10deg); }
}

.loader-text {
	font-size: 0.86rem;
	font-weight: 700;
	letter-spacing: 0.22em;
	text-transform: uppercase;
}

.loader-dots i {
	font-style: normal;
	animation: loader-dot 1.2s steps(1) infinite;
}

.loader-dots i:nth-child(2) {
	animation-delay: 0.2s;
}

.loader-dots i:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes loader-dot {
	0%, 20% { opacity: 0; }
	30%, 100% { opacity: 1; }
}

/* Round 5: the casino, players and sharing -------------------------------- */

.picker-tools {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 18px;
}

/* The Players button: a dot when a request or a challenge waits. */
.tool-players {
	position: relative;
}

.tool-badge {
	position: absolute;
	top: 3px;
	right: 3px;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--ink);
	box-shadow: 0 0 0 2px var(--paper);
	animation: pop 0.5s var(--ease);
}

/* Names on the boards open the player's card. */
.board-player {
	display: block;
	min-width: 0;
	max-width: 100%;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
}

.board-player:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Shop and casino tabs. */
.shop-tabs {
	display: flex;
	gap: 8px;
	margin-top: 18px;
}

.shop-tabs .board-tab[aria-selected="true"] {
	border-color: var(--ink);
	background: var(--ink);
	color: var(--paper);
}

/* The casino. */
.stake {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 18px 0 6px;
}

.stake .over-label {
	margin-right: 4px;
}

.stake-button {
	min-width: 44px;
	min-height: 36px;
	padding: 0 12px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--paper);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	cursor: pointer;
}

.stake-button:hover {
	border-color: var(--ink);
}

.stake-button[aria-pressed="true"] {
	border-color: var(--ink);
	background: var(--ink);
	color: var(--paper);
}

.casino-games {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
	gap: 14px;
	margin-top: 4px;
}

.casino-game {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 18px 16px;
	border: 1px solid var(--line);
	background: var(--paper);
	text-align: center;
}

.casino-game .shop-group-title {
	margin-bottom: 6px;
}

.casino-how {
	margin: 0 0 12px;
	color: var(--mute);
	font-size: 0.86rem;
}

.casino-wait {
	margin: 10px 0 0;
}

.casino-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin-top: 12px;
}

.casino-actions .pill:disabled {
	opacity: 0.4;
	cursor: default;
	transform: none;
}

.coin,
.wheel,
.reel {
	display: block;
}

.reels {
	display: flex;
	gap: 8px;
	padding: 8px;
	border: 1.5px solid var(--ink);
	border-radius: 12px;
}

.reel {
	border-radius: 6px;
	box-shadow: inset 0 0 0 1px var(--line);
}

.wheel-wrap {
	position: relative;
	padding-top: 6px;
}

/* The wheel's marker: decoration, not a control. */
.wheel-pointer {
	position: absolute;
	top: 0;
	left: 50%;
	width: 0;
	height: 0;
	border-right: 9px solid transparent;
	border-left: 9px solid transparent;
	border-top: 16px solid var(--ink);
	transform: translateX(-50%);
}

.pays {
	width: 100%;
	margin-top: 14px;
	text-align: left;
}

.pays summary {
	cursor: pointer;
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.pays-table {
	width: 100%;
	margin: 10px 0;
	border-collapse: collapse;
	font-size: 0.86rem;
}

.pays-table td {
	padding: 5px 2px;
	border-bottom: 1px solid var(--line);
}

.pays-table td:last-child {
	font-weight: 700;
	text-align: right;
}

/* Players. */
.players-top {
	display: grid;
	gap: 14px;
	margin-top: 8px;
}

.players-guest,
.invite {
	max-width: 620px;
	padding: 14px 16px;
	border: 1px dashed var(--ink);
}

.players-guest p,
.invite p {
	margin: 0 0 10px;
}

.players-search {
	display: flex;
	gap: 8px;
	max-width: 520px;
}

.players-search input,
.card-challenge select {
	min-height: 44px;
	padding: 0 12px;
	border: 1px solid var(--ink);
	border-radius: 0;
	background: var(--paper);
	color: var(--ink);
	font: inherit;
}

.players-search input {
	flex: 1;
	min-width: 0;
}

.players-groups {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
	align-items: start;
	gap: 0 28px;
}

.lobby-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.player-row {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 6px 4px;
	border: 0;
	border-bottom: 1px solid var(--line);
	background: none;
	text-align: left;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.player-row:hover {
	background: var(--line);
}

.player-row .icon {
	margin-left: auto;
	color: var(--mute);
	transition: transform 0.2s var(--ease);
}

.player-row:hover .icon {
	color: var(--ink);
}

.player-bean {
	flex: none;
}

.player-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.player-name {
	overflow: hidden;
	font-weight: 700;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.player-meta {
	color: var(--mute);
	font-size: 0.8rem;
}

.lobby-item {
	padding: 10px 4px;
	border-bottom: 1px solid var(--line);
}

.lobby-text {
	margin: 0 0 8px;
}

.lobby-item .join-actions {
	gap: 8px;
}

/* A player's card. */
.card {
	margin-top: 8px;
}

.card-back .icon {
	font-size: 1.1rem;
}

.card-head {
	display: flex;
	align-items: center;
	gap: 16px;
	margin: 10px 0 14px;
}

.card-bean {
	flex: none;
}

.card-name {
	margin: 0;
	font-size: clamp(1.6rem, 4vw, 2.2rem);
	font-weight: 300;
}

.card-name:focus {
	outline: none;
}

.card-seen {
	margin: 2px 0 0;
	color: var(--mute);
}

.card-overall {
	margin: 2px 0 0;
	font-weight: 600;
}

.card-bests {
	max-width: 560px;
	margin: 0 0 16px;
	padding: 0;
	list-style: none;
}

.card-bests .board-row {
	grid-template-columns: 1fr auto auto;
	font-size: 1rem;
}

.card-actions {
	margin-bottom: 22px;
}

.card-challenge {
	max-width: 560px;
	padding-top: 16px;
	border-top: 1px solid var(--ink);
}

/* End of a game: how the challenges went, and sharing. */
.over-challenges {
	margin: 4px 0 6px;
	padding: 0;
	list-style: none;
	font-weight: 600;
}

.over-challenges li + li {
	margin-top: 4px;
}

.over-share {
	margin: -4px 0 10px;
}

/* The share box. */
.share {
	z-index: 40;
}

.share-url {
	margin: 12px 0 10px;
}

.share-url input {
	width: 100%;
	min-height: 40px;
	padding: 0 10px;
	border: 1px solid var(--line);
	background: var(--paper);
	color: var(--ink);
	font: inherit;
	font-size: 0.86rem;
}

.share-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.share-links .pill {
	min-height: 38px;
	padding: 0 14px;
	font-size: 0.72rem;
}

@media (max-width: 600px) {
	.casino-game {
		padding: 16px 10px;
	}

	.reels {
		gap: 6px;
		padding: 6px;
	}

	.card-head {
		gap: 10px;
	}

	.card-bean {
		width: 96px !important;
		height: 88px !important;
	}
}

/* Round 6: anime avatars ------------------------------------------------------ */

/* A grey sunburst behind every avatar, so the arcade stays black and white
   and the avatars bring the colour. */
.account-face,
.player-face,
.card-face,
.avatar-builder .avb-preview {
	background: repeating-conic-gradient(from 4deg at 50% 58%, var(--paper) 0deg 9deg, var(--line) 9deg 18deg);
}

.account-face,
.player-face,
.card-face {
	display: block;
	flex: none;
	overflow: hidden;
	border: 1.5px solid var(--ink);
	border-radius: 50%;
}

.account-face svg,
.player-face svg,
.card-face svg {
	display: block;
	width: 100%;
	height: 100%;
}

.account-avatar {
	display: flex;
	align-items: center;
	gap: 16px;
	margin: 4px 0 20px;
}

.account-avatar p {
	margin: 0 0 10px;
	color: var(--mute);
}

.account-face {
	width: 88px;
	height: 88px;
}

.player-face {
	width: 40px;
	height: 40px;
}

.card-face {
	width: 120px;
	height: 120px;
	border-radius: 20px;
}

.avatar-panel .shop-inner {
	max-width: 1080px;
}

.avatar-builder {
	margin-top: 14px;
}

/* Save stays in reach while the choices scroll. */
.avatar-actions {
	position: sticky;
	bottom: 0;
	margin-top: 18px;
	padding: 12px 0 14px;
	border-top: 1px solid var(--line);
	background: var(--paper);
}

@media (max-width: 600px) {
	.card-face {
		width: 96px;
		height: 96px;
	}
}

/* Round 7: game options with explainers ----------------------------------------- */
.switch-row {
	position: relative;
	display: flex;
	align-items: center;
	gap: 2px;
	margin: 0 0 12px;
}

.switch-row .switch {
	margin: 0;
}

.switch-help {
	position: static;
}

.switch-info {
	display: inline-grid;
	place-items: center;
	padding: 6px;
	border: 0;
	background: none;
	color: var(--mute);
	font-size: 1rem;
	cursor: help;
}

.switch-info:hover,
.switch-help.is-open .switch-info {
	color: var(--ink);
}

.switch-tip {
	position: absolute;
	left: 0;
	bottom: calc(100% + 6px);
	z-index: 6;
	width: max-content;
	max-width: min(280px, 80vw);
	padding: 9px 12px;
	border-radius: 8px;
	background: var(--ink);
	color: var(--paper);
	font-size: 0.82rem;
	font-weight: 500;
	letter-spacing: 0;
	line-height: 1.45;
	text-transform: none;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(4px);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.switch-row:hover .switch-tip,
.switch-row:focus-within .switch-tip,
.switch-help.is-open .switch-tip {
	opacity: 1;
	visibility: visible;
	transform: none;
}

/* The play panel ------------------------------------------------------------
   Opens from Play on a game: how to play, who to play and the options,
   then a big Start. */
.setup-inner {
	max-width: 900px;
}

.setup-head {
	align-items: flex-start;
}

.setup-mark {
	margin: 0 0 10px;
	outline: none;
}

.setup-goal {
	max-width: 60ch;
	margin: 0;
	font-size: 1.02rem;
	line-height: 1.55;
}

.setup-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
	gap: 28px 40px;
	padding: 24px 0;
}

.setup-label {
	margin: 0 0 14px;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--mute);
}

.controls {
	display: grid;
	gap: 8px;
	margin: 0;
}

.control {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
	gap: 12px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--line);
}

.control dt {
	font-weight: 700;
}

.control dd {
	margin: 0;
	color: var(--mute);
}

/* Keys on a computer, touch on a phone or tablet. */
.controls-touch {
	display: none;
}

@media (pointer: coarse) {
	.controls-keys {
		display: none;
	}

	.controls-touch {
		display: grid;
	}
}

.setup-turn {
	display: none;
	align-items: center;
	gap: 10px;
	margin: 16px 0 0;
	padding: 10px 14px;
	border: 1.5px dashed var(--ink);
	font-weight: 700;
}

.setup-turn .icon {
	flex: none;
	font-size: 1.6rem;
}

@media (pointer: coarse) and (orientation: portrait) {
	.setup-turn {
		display: flex;
	}
}

.modes {
	display: grid;
	gap: 10px;
}

.mode {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 14px;
	padding: 14px 16px;
	border: 1.5px solid var(--line);
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.mode input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.mode:hover {
	border-color: var(--mute);
}

.mode:has(input:checked) {
	border-color: var(--ink);
	background: color-mix(in srgb, var(--ink) 6%, transparent);
}

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

.mode.is-soon {
	cursor: default;
	opacity: 0.55;
}

.mode-icon {
	flex: none;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 1.5px solid var(--ink);
	border-radius: 50%;
	font-size: 1.25rem;
}

.mode:has(input:checked) .mode-icon {
	background: var(--ink);
	color: var(--paper);
}

.mode-text {
	display: grid;
	gap: 3px;
}

.mode-name {
	font-weight: 700;
}

.mode-desc,
.mode-count,
.mode-soon {
	font-size: 0.9rem;
	line-height: 1.45;
	color: var(--mute);
}

.mode-count {
	font-weight: 700;
	color: var(--ink);
}

.mode-soon {
	font-style: italic;
}

.setup-option {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	margin: 0 0 16px;
	font-size: 1rem;
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
}

.setup-option .switch-track {
	flex: none;
	margin-top: 2px;
}

.setup-option-text {
	display: grid;
	gap: 3px;
}

.setup-option-name {
	font-weight: 700;
}

.setup-option-help {
	font-size: 0.9rem;
	line-height: 1.45;
	color: var(--mute);
}

/* Start stays in view at the foot of the panel, however long it is. */
.setup-actions {
	position: sticky;
	bottom: 0;
	z-index: 2;
	display: flex;
	justify-content: flex-end;
	padding: 14px 0 16px;
	border-top: 1px solid var(--ink);
	background: var(--veil);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}

.setup-start {
	min-height: 56px;
	padding: 0 40px;
	font-size: 1.1rem;
}

@media (max-width: 600px) {
	.setup-start {
		width: 100%;
	}
}

/* Turn your phone: a phone held upright while a game is on. */
.turn-phone {
	display: none;
}

@media (pointer: coarse) and (orientation: portrait) {
	.is-playing .turn-phone {
		position: fixed;
		inset: 0;
		z-index: 40;
		display: grid;
		place-items: center;
		padding: 32px;
		background: var(--paper);
		color: var(--ink);
		text-align: center;
	}
}

.turn-phone-inner > .icon {
	font-size: 4rem;
	animation: turn-phone 2.4s var(--ease) infinite;
}

.turn-phone-title {
	margin: 18px 0 6px;
	font-size: 1.3rem;
	font-weight: 700;
}

.turn-phone-text {
	margin: 0;
	color: var(--mute);
}

@keyframes turn-phone {
	0%, 20% { transform: rotate(-90deg); }
	55%, 100% { transform: rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
	.turn-phone-inner > .icon {
		animation: none;
	}
}

/* Choices on the play panel: one of a few, as a row of pills. */
.setup-choice {
	display: grid;
	gap: 6px;
	margin: 0 0 18px;
	padding: 0;
	border: 0;
}

.setup-choice legend {
	padding: 0;
	margin-bottom: 2px;
}

.choice-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 4px;
}

.choice {
	position: relative;
	cursor: pointer;
}

.choice input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.choice span {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	padding: 0 14px;
	border: 1.5px solid var(--line);
	border-radius: 999px;
	font-size: 0.9rem;
	font-weight: 700;
	transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.choice:hover span {
	border-color: var(--mute);
}

.choice input:checked + span {
	border-color: var(--ink);
	background: var(--ink);
	color: var(--paper);
}

.choice input:focus-visible + span {
	outline: 3px solid var(--ink);
	outline-offset: 2px;
}

/* Difficulty, the paid skip, email at sign-up and games for computers only
   (16 November 2026). ----------------------------------------------------- */
.game-tier {
	margin: -12px 0 16px;
	color: var(--mute);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.game-tier:empty {
	display: none;
}

.game-desktop-note,
.setup-desktop-note {
	display: none;
	margin: 0 0 12px;
	font-size: 0.88rem;
	font-weight: 600;
	text-wrap: pretty;
}

/* On a touch screen, a game for computers only says so in place of Play. */
@media (pointer: coarse) {
	.game--desktop .game-desktop-note,
	.setup-desktop-note {
		display: block;
	}

	.game--desktop .game-actions [data-play] {
		opacity: 0.55;
	}
}

.setup-start:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.picker-note {
	margin: 4px 0 0;
	font-weight: 600;
	text-wrap: pretty;
}

.over-tier {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	margin: 0 0 8px;
}

.over-tier[hidden] {
	display: none;
}

.over-tier-text {
	margin: 0;
	color: var(--mute);
	text-wrap: pretty;
}

.join-optional {
	color: var(--mute);
	font-weight: 400;
}

.join-row[hidden],
.join-note[hidden] {
	display: none;
}

/* First-visit tips, today's challenge, achievements and end-panel awards
   (16 November 2026). Hover changes light only. -------------------------- */
.tips {
	margin: 0 0 20px;
	padding: 16px 18px;
	border: 1px dashed var(--ink);
}

.tips[hidden],
.daily[hidden],
.awards[hidden],
.over-awards[hidden] {
	display: none;
}

.tips-list {
	margin: 0 0 12px;
	padding-left: 1.2em;
	text-wrap: pretty;
}

.tips-list li[hidden] {
	display: none;
}

.tips-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
}

.daily {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
	gap: 16px 24px;
	margin: 0 0 24px;
	padding: 18px 20px;
	border: 1px solid var(--ink);
}

.daily.is-done {
	border-style: dashed;
}

.daily-label {
	margin: 0 0 4px;
	color: var(--mute);
	font-size: 0.74rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.daily-game {
	margin: 0 0 6px;
	font-size: 1.4rem;
	text-wrap: balance;
}

.daily-goal,
.daily-reward,
.daily-streak {
	margin: 0 0 6px;
	text-wrap: pretty;
}

.daily-reward {
	font-weight: 700;
}

.daily-streak {
	color: var(--mute);
}

.daily-side {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
}

.daily-board {
	width: 100%;
	margin: 0;
	padding-left: 1.4em;
	font-size: 0.9rem;
}

.daily-board li {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 2px 0;
}

.daily-board .daily-empty {
	display: list-item;
	color: var(--mute);
	list-style: none;
	margin-left: -1.4em;
}

.daily-score {
	font-variant-numeric: tabular-nums;
	font-weight: 700;
}

@media (max-width: 640px) {
	.daily {
		grid-template-columns: 1fr;
	}
}

.awards {
	margin-top: 28px;
}

.awards-note {
	margin: 0 0 12px;
	color: var(--mute);
	text-wrap: pretty;
}

.awards-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.award {
	display: grid;
	gap: 2px;
	padding: 12px 14px;
	border: 1px dashed var(--line);
	color: var(--mute);
}

.award.is-earned {
	border: 1px solid var(--ink);
	color: var(--ink);
}

.award-name {
	font-weight: 700;
	text-wrap: balance;
}

.award-how,
.award-prize {
	font-size: 0.84rem;
	text-wrap: pretty;
}

.award-prize {
	font-style: italic;
}

.over-awards {
	margin: 0 0 10px;
	padding: 0;
	list-style: none;
	font-weight: 700;
}

.over-awards li {
	padding: 4px 0;
	text-wrap: pretty;
}
