/* Lilanaya — the "Arcade" direction. Source of truth: spec/docs/design/visual-direction.md.
   Black field, white blocks, pixel display type, dashed dividers. No gradients, shadows or
   rounded corners. Two signal colours only: blue = cooperate, magenta = defect.
   Two flag colours, on flags only: red = breaks the rules, yellow = an assumption was made.
   A winner is raised: nudged up and left over a hard-edged block shadow, never blurred.
   Everything else stays black, white and grey. */

@font-face {
	font-family: 'Press Start 2P';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/fonts/press-start-2p-latin-400-normal.woff2') format('woff2');
}

@font-face {
	font-family: 'IBM Plex Mono';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}

@font-face {
	font-family: 'IBM Plex Mono';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url('/fonts/ibm-plex-mono-latin-600-normal.woff2') format('woff2');
}

:root {
	--bg: #000000;
	--fg: #ffffff;
	--muted: #a6a6a6;
	--ghost: #2e2e2e; /* outlines of squares not yet played; never text */
	/* Signal colours. Used for moves only, never for decoration or body text. */
	--coop: #3fc5f0; /* cooperate (in other worlds: the first decision) */
	--defect: #e25bd8; /* defect (any other decision); a colour without a verdict: neither move is the wrong one */
	/* Flag colours. A verdict on purpose, so only ever on a flag: its frame, mark and title. */
	--alert: #ff4d4d; /* breaks the rules */
	--caution: #ffd23f; /* an assumption was made */
	--raise: 4px; /* how far a winner stands out from the field */
	--lane: #1c1c1c; /* the band behind whatever belongs to the visitor in a game played by hand */
	--font-display: 'Press Start 2P', monospace;
	--font-body: 'IBM Plex Mono', ui-monospace, monospace;
	--gutter: 32px;
	color-scheme: dark;
}

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

[hidden] {
	display: none !important;
}

body {
	margin: 0;
	min-height: 100vh;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--font-body);
	font-size: 14px;
	line-height: 1.5;
}

h1,
h2,
p,
ul,
dl,
dd,
fieldset {
	margin: 0;
	padding: 0;
}

fieldset {
	border: 0;
	min-width: 0;
}

ul {
	list-style: none;
}

strong,
th {
	font-weight: 600;
}

a {
	color: var(--muted);
}

a:hover {
	color: var(--fg);
}

:focus-visible {
	outline: 3px dashed var(--fg);
	outline-offset: 3px;
}

main:focus,
h1:focus {
	outline: none;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.skip-link {
	position: absolute;
	left: 8px;
	top: -100px;
	z-index: 1;
	padding: 14px;
	background: var(--fg);
	color: var(--bg);
	font: 11px var(--font-display);
	text-transform: uppercase;
}

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

/* --- layout --- */

main {
	max-width: 1100px;
	margin: 0 auto;
	padding: var(--gutter);
}

.stack-sm,
.stack,
.stack-md,
.stack-lg {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.stack-sm {
	gap: 8px;
}

.stack {
	gap: 14px;
}

.stack-md {
	gap: 24px;
}

.stack-lg {
	gap: 40px;
}

.row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
}

.spread {
	justify-content: space-between;
}

.columns {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 40px;
}

.columns > * {
	flex: 1 1 400px;
	min-width: 0;
}

.columns > .high-scores {
	flex-basis: 480px;
}

.prose {
	max-width: 68ch;
}

.meta {
	color: var(--muted);
	text-transform: uppercase;
}

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

/* --- screens (components/screen.js) ---
   Every page is a column of screens. A screen is as tall as the window and holds one thing to look
   at, in the middle; letting go of a scroll settles on the nearest screen, never in between. What is
   on a screen is sized to fit it (long lists are paged, charts take the height that is left); a
   screen that still ends up taller than the window can be scrolled through. */
main:has(> .screens) {
	padding-block: 0; /* the screens bring their own room */
}

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

.screen {
	display: flex;
	flex-direction: column;
	justify-content: safe center;
	min-width: 0;
	min-height: 100svh;
	padding-block: var(--gutter);
	scroll-snap-align: start;
}

/* The first screen shares the window with the header, so it settles by its bottom edge: the top of the page. */
.screens > .screen:first-child,
.screens > .screen-group:first-child > .screen:first-child {
	min-height: calc(100svh - var(--header-height, 71px));
	scroll-snap-align: end;
}

/* The top of the page is always a place to rest, also when the first screen is taller than the window. */
html:has(.screens) #header {
	scroll-snap-align: start;
}

/* On a wide window, screens that would each be mostly empty share one (components/screen.js, screenGroup):
   side by side, tops level, the group in the middle of the window. Narrow, each is its own screen again. */
.screen-group {
	display: contents;
}

@media (min-width: 901px) {
	.screen-group {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		align-items: start;
		align-content: safe center;
		gap: 40px;
		min-height: 100svh;
		padding-block: var(--gutter);
		scroll-snap-align: start;
	}

	.screen-group.wide-left {
		grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	}

	.screen-group:first-child {
		min-height: calc(100svh - var(--header-height, 71px));
		scroll-snap-align: end;
	}

	.screens > .screen-group > .screen,
	.screens > .screen-group:first-child > .screen:first-child {
		justify-content: flex-start;
		min-height: 0;
		padding-block: 0;
		scroll-snap-align: none;
	}

	.screen-group > .span {
		grid-column: 1 / -1;
	}

	/* A match shown beside the table it was picked from: smaller numbers, and twenty rounds to a line. */
	.screen-group .match-score {
		font-size: clamp(32px, 4vw, 56px);
	}

	.screen-group .round-strip {
		grid-template-columns: repeat(20, minmax(0, 28px));
	}

	.screen-group .match-note {
		display: none;
	}

	/* The next screen is beside this one, not below it. */
	.screen-group .next-step {
		display: none;
	}
}

/* A screen with nothing picked yet is only worth its place next to what it is picked from. */
@media (max-width: 900px) {
	.screen.is-empty {
		display: none;
	}
}

.pager-nav {
	gap: 14px;
}

/* Short descriptions side by side: the baseline actors of a world. */
.actor-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
	gap: 20px 40px;
}

/* Anything wider than a phone scrolls inside its own box. */
.scroll-box {
	overflow-x: auto;
	max-width: 100%;
}

/* --- header --- */

.site-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 28px;
	padding: 10px var(--gutter);
	border-bottom: 6px dashed var(--fg);
}

.logo {
	font: 18px var(--font-display);
	color: var(--fg);
	text-decoration: none;
	text-transform: uppercase;
}

.site-nav {
	display: flex;
	flex-wrap: wrap;
	flex-grow: 1;
	gap: 6px;
	font: 11px var(--font-display);
	text-transform: uppercase;
}

.site-nav a {
	padding: 17px 12px; /* 11px type + 34px = 45px tall */
	text-decoration: none;
}

.site-nav a[aria-current='page'] {
	background: var(--fg);
	color: var(--bg);
}

/* --- buttons --- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 4px 14px;
	background: var(--bg);
	color: var(--fg);
	border: 4px solid var(--fg);
	border-radius: 0;
	font: 11px/1.4 var(--font-display);
	text-transform: uppercase;
	text-decoration: none;
	text-align: center;
	cursor: pointer;
}

.btn:hover {
	background: var(--fg);
	color: var(--bg);
}

.btn-primary {
	background: var(--fg);
	color: var(--bg);
}

.btn-primary:hover {
	background: var(--bg);
	color: var(--fg);
}

.btn:disabled {
	background: var(--bg);
	color: var(--muted);
	border-color: var(--muted);
	cursor: default;
}

/* --- headings --- */

.section-heading {
	font: 400 13px/1.5 var(--font-display);
	text-transform: uppercase;
}

.section-heading a {
	color: var(--fg);
}

/* --- cards and lists --- */

.cards {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.card {
	padding: 20px;
	border: 3px solid var(--fg);
}

/* Folding cards (components/fold.js): one line on show, the rest behind it. */
.cards.folds {
	gap: 10px;
}

.card.fold {
	padding: 0;
}

.fold > details > summary {
	gap: 4px 14px;
	padding: 6px 20px;
	color: var(--fg);
	text-transform: none;
}

.fold > details > summary::before {
	flex: none;
	width: 2ch;
	font-family: var(--font-display);
}

.fold > details > summary .section-heading {
	margin: 0;
}

.fold-tags {
	margin-left: auto;
	text-align: right;
}

.fold-body {
	padding: 6px 20px 20px;
}

.plain-list {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

/* Long unbroken names (file names, ids) break rather than push the page wider than the screen. */
.plain-list li {
	min-width: 0;
	overflow-wrap: anywhere;
}

.plain-list.tight {
	gap: 6px;
}

details > summary {
	min-height: 44px;
	display: flex;
	align-items: center;
	cursor: pointer;
	color: var(--muted);
	text-transform: uppercase;
}

details > summary::before {
	content: '+ ';
	white-space: pre;
}

details[open] > summary::before {
	content: '- ';
}

.rules {
	display: grid;
	grid-template-columns: max-content minmax(0, 1fr);
	gap: 8px 20px;
}

/* --- plain data tables --- */

table {
	border-collapse: collapse;
}

.grid-table th,
.grid-table td {
	padding: 10px 14px;
	border: 3px solid var(--fg);
	text-align: left;
	vertical-align: top;
}

.grid-table thead th {
	color: var(--muted);
	text-transform: uppercase;
}

.grid-table thead td:empty {
	border-top-color: transparent;
	border-left-color: transparent;
}

.grid-table caption {
	padding-bottom: 8px;
	text-align: left;
}

.grid-table .num {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.rank,
.score {
	font: 12px/1.6 var(--font-display);
}

/* --- match view --- */

.match {
	display: flex;
	align-items: stretch;
}

.match-side {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.match-left {
	align-items: flex-end;
	padding-right: var(--gutter);
	text-align: right;
}

.match-right {
	align-items: flex-start;
	padding-left: var(--gutter);
}

.match-name {
	font: 13px/1.5 var(--font-display);
	text-transform: uppercase;
	overflow-wrap: anywhere;
}

.match-score {
	font: clamp(36px, 8vw, 88px) / 1 var(--font-display);
	font-variant-numeric: tabular-nums;
}

.centre-line {
	width: 0;
	border-left: 8px dashed var(--fg);
}

/* Narrow screens: a wide table (`.stacks`) turns each row into a block, one labelled line per cell,
   so nothing has to scroll sideways. Cells carry their column heading in `data-label`. */
@media (max-width: 600px) {
	.grid-table.stacks,
	.grid-table.stacks tbody,
	.grid-table.stacks tr {
		display: block;
		width: 100%;
	}

	.grid-table.stacks thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
	}

	.grid-table.stacks tr {
		margin-bottom: 10px;
		border: 3px solid var(--fg);
	}

	.grid-table.stacks th,
	.grid-table.stacks td {
		display: flex;
		justify-content: space-between;
		gap: 14px;
		padding: 6px 10px;
		border: 0;
		text-align: right;
		overflow-wrap: anywhere;
	}

	.grid-table.stacks td[data-label]::before {
		content: attr(data-label);
		flex: none;
		color: var(--muted);
		font: 400 14px/1.5 var(--font-body);
		text-transform: uppercase;
	}
}

/* Narrow screens: the high-score table gives up fixed column widths so it fits without scrolling. */
@media (max-width: 600px) {
	.bars th,
	.bars td {
		padding-right: 8px;
	}

	.bars .rank {
		width: 20px;
	}

	.bars .name {
		width: 42%;
	}

	.bars .score,
	.bars .score-head {
		width: 58px;
	}

	.bars .avatar-name {
		gap: 6px;
		overflow-wrap: anywhere;
	}
}

/* --- the race: a run as a season of match days --- */

/* The fixtures of the match day being played, above the chart; gone once the season is over. */
.fixtures {
	display: grid;
	gap: 12px;
	padding: 14px;
	border: 3px solid var(--fg);
}

.fixtures-title {
	font: 13px/1.4 var(--font-display);
	text-transform: uppercase;
}

.fixtures-list {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Home name, home score, dash, away score, away name: the scores meet in the middle. */
.fixture {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(5ch, max-content) max-content minmax(5ch, max-content) minmax(0, 1fr);
	align-items: center;
	gap: 10px;
	color: var(--muted);
}

.fixture-side {
	min-width: 0;
	overflow-wrap: anywhere;
}

.fixture-home {
	text-align: right;
}

.fixture-home .avatar-name {
	flex-direction: row-reverse;
	text-align: right;
}

.fixture-score {
	color: var(--fg);
	font: 14px/1.4 var(--font-display);
	font-variant-numeric: tabular-nums;
}

.fixture-home + .fixture-score {
	text-align: right;
}

/* At the whistle the side with more points turns white and its name is underlined. */
.fixture.home-won .fixture-home,
.fixture.away-won .fixture-away {
	color: var(--fg);
	text-decoration: underline;
	text-underline-offset: 4px;
}

.fixtures-bench {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.fixtures.is-wiping {
	animation: fixtures-wipe 0.35s steps(7) forwards;
}

@keyframes fixtures-wipe {
	to {
		clip-path: inset(0 0 0 100%);
	}
}

@media (max-width: 600px) {
	.fixture {
		gap: 6px;
		font-size: 12px;
	}

	.fixture-score {
		font-size: 11px;
	}

	.fixture .avatar {
		display: none;
	}
}


/* The race fills what its screen has left: the chart is drawn to the height of its frame, so the
   fixtures, the chart and the caption stay inside the window together. */
.race {
	flex: 1 1 auto;
	max-height: 760px;
	margin: 0;
}

/* While fixtures are on show the small print under the race makes way for the chart. */
.race-screen:has(.fixtures:not([hidden])) > .meta:last-child {
	display: none;
}

.race-frame {
	position: relative;
	flex: 1 1 0;
	min-height: 180px;
}

.race-chart {
	position: absolute;
	inset: 0;
	display: block;
	max-width: 100%;
}

.race-grid {
	stroke: var(--ghost);
	stroke-width: 1;
}

.race-axis {
	stroke: var(--muted);
	stroke-width: 1;
}

.race-cursor {
	stroke: var(--muted);
	stroke-width: 1;
	stroke-dasharray: 4 4;
}

.race-tick {
	fill: var(--muted);
	font: 12px var(--font-body);
	font-variant-numeric: tabular-nums;
}

/* Lines are grey, the leader white; a roll-call makes one line white and thick and dims the rest. */
.race-line {
	stroke: var(--muted);
	stroke-width: 2;
	stroke-linejoin: round;
}

.race-dot {
	fill: var(--muted);
}

.race-line.is-leading,
.race-line.is-called,
.race-line.is-pointed {
	stroke: var(--fg);
}

.race-line.is-called,
.race-line.is-pointed {
	stroke-width: 4;
}

.race-dot.is-leading,
.race-dot.is-called,
.race-dot.is-pointed {
	fill: var(--fg);
}

/* What is pointed at: a wide unseen copy of each line, and its end label. */
.race-hit {
	stroke: transparent;
	stroke-width: 16;
	pointer-events: stroke;
	cursor: pointer;
}

.race-label {
	cursor: default;
}

.race-label.is-pointed {
	color: var(--fg);
	fill: var(--fg);
}

/* The finished chart can be clicked: the column of the match day that was picked is lit. */
.race:not(.is-playing) .race-chart {
	cursor: pointer;
}

.race-day {
	fill: var(--lane);
}

.race-days {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.race-day-button {
	min-width: 44px;
	padding-inline: 10px;
}

.race-day-button[aria-pressed='true'] {
	background: var(--fg);
	color: var(--bg);
}

.race-line.is-dimmed,
.race-dot.is-dimmed,
.race-label.is-dimmed {
	opacity: 0.35;
}

.race-label {
	color: var(--muted);
	fill: var(--muted);
}

.race-label.is-leading,
.race-label.is-called {
	color: var(--fg);
	fill: var(--fg);
}

.race-plate {
	fill: none;
}

.race-label.is-called .race-plate {
	fill: var(--fg);
}

.race-label.is-called {
	color: var(--bg);
	fill: var(--bg);
}

.race-name {
	font: 600 12px var(--font-body);
}

.race-total {
	font: 12px var(--font-body);
	font-variant-numeric: tabular-nums;
}

.race-caption {
	min-height: 3em; /* two lines, so the page does not jump as the caption changes */
	font: 13px/1.5 var(--font-display);
	text-transform: uppercase;
}

/* --- round strip --- */

.round-strip {
	display: grid;
	/* Squares are 18px to 28px wide. Where the rounds do not fit on one line they carry on on the next,
	   so the strip never needs scrolling sideways. */
	grid-template-columns: repeat(auto-fit, minmax(18px, 28px));
	gap: 14px 5px;
	max-width: calc(var(--rounds) * 33px);
}

.round {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.sq {
	aspect-ratio: 1;
	border: 3px solid var(--ghost);
}

.sq-solid {
	background: var(--coop);
	border-color: var(--coop);
}

.sq-hollow {
	background: var(--defect);
	border-color: var(--defect);
}

.legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 28px;
}

.legend-item {
	display: flex;
	align-items: center;
	gap: 8px;
}

.swatch {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 3px solid var(--defect);
	background: var(--defect);
}

.swatch-solid {
	border-color: var(--coop);
	background: var(--coop);
}

.swatch-win {
	border-color: var(--fg);
	background: var(--muted);
}

/* --- high scores --- */

.bars {
	width: 100%;
	max-width: 860px;
	border-collapse: separate;
	border-spacing: 0 14px;
	margin: -14px 0;
}

.bars th,
.bars td {
	padding: 0 14px 0 0;
	text-align: left;
	font-weight: 400;
	vertical-align: middle;
}

.bars thead th {
	font-weight: 400;
}

.bars .rank {
	width: 32px;
}

.bars .name {
	width: 170px;
}

.bars .bar-cell {
	width: auto;
}

.bars .score,
.bars .score-head {
	width: 66px;
	text-align: right;
}

/* A score bar: white, whatever the competitor does. Its length is the score and nothing else. */
.bar {
	height: 20px;
	border: 3px solid var(--fg);
	background: var(--fg);
}

.bar-plain {
	border-color: var(--fg);
	background: var(--fg);
}

/* --- head to head --- */

/* The head-to-head table always fits its box: the cells share the width, and the lettering shrinks with them. */
.matrix-box {
	container-type: inline-size;
	max-width: 100%;
}

.matrix {
	border-collapse: separate;
	border-spacing: clamp(2px, 0.6cqw, 5px);
	width: 100%;
	max-width: calc((var(--n) + 1) * 110px);
	table-layout: fixed;
	font-size: clamp(8px, calc(100cqw / (var(--n) + 1) / 3.4), 14px);
}

.matrix .avatar {
	width: clamp(12px, calc(100cqw / (var(--n) + 1) / 2), 24px);
	height: auto;
	aspect-ratio: 1;
}

/* Rows share the window's height too: a big field gets lower rows rather than a table taller than the screen. */
.matrix {
	--cell: clamp(26px, calc((100svh - 300px) / (var(--n) + 1)), 44px);
}

.matrix th,
.matrix td {
	height: var(--cell);
	padding: 0;
	text-align: center;
	color: var(--muted);
}

.matrix abbr {
	text-decoration: none;
}

.matrix .cell {
	font-weight: 600;
}

.matrix .cell a {
	display: flex;
	align-items: center;
	justify-content: center;
	height: var(--cell);
	color: inherit;
	text-decoration: none;
}

.matrix .cell a:hover {
	text-decoration: underline;
}

/* The match on show: a dashed frame inside the cell, in the cell's own text colour. */
.matrix .cell a[aria-current] {
	outline: 3px dashed currentColor;
	outline-offset: -6px;
}

.matrix .cell a:focus-visible {
	outline: 3px dashed var(--fg);
	outline-offset: 3px;
}

/* --- forms --- */

.form {
	max-width: 640px;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}

.field-row > .field {
	flex: 1 1 200px;
}

.field-row {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
}

.field-label {
	font: 11px/1.5 var(--font-display);
	text-transform: uppercase;
}

legend.field-label {
	padding: 0;
	margin-bottom: 8px;
}

input[type='number'],
input[type='text'],
input[type='email'],
textarea,
select {
	width: 100%;
	min-height: 44px;
	padding: 6px 10px;
	background: var(--bg);
	color: var(--fg);
	border: 3px solid var(--fg);
	border-radius: 0;
	font: inherit;
}

textarea {
	min-height: 96px;
	line-height: 1.5;
	resize: vertical;
}

textarea.code-input {
	min-height: clamp(160px, 100svh - 700px, 420px); /* with the name and description above it, one screen */
	white-space: pre;
	overflow: auto;
	tab-size: 2;
}

input[aria-invalid='true'] {
	border-style: dashed;
}

.check {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	min-height: 44px;
	padding: 6px 0;
	cursor: pointer;
}

.check input {
	appearance: none;
	flex: none;
	width: 24px;
	height: 24px;
	margin: 0;
	border: 3px solid var(--fg);
	border-radius: 0;
	background: var(--bg);
	cursor: pointer;
}

/* Many choices side by side, each with a note of at most two lines, so the field fits a screen. */
.check-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
	gap: 0 32px;
}

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

.check-note {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
}

/* A short window keeps one line of each note. */
@media (max-height: 800px) {
	.check-note {
		-webkit-line-clamp: 1;
	}
}

.editor-details > .field:last-child {
	flex-grow: 2;
}

.editor-details textarea {
	min-height: 68px;
}

/* Checked: a solid block inset in the frame. */
.check input:checked {
	padding: 3px;
	background: var(--fg) content-box;
}

.error-box {
	padding: 14px;
	border: 3px dashed var(--fg);
}

.error-box ul {
	margin-top: 8px;
	padding-left: 20px;
	list-style: square;
}

.notice {
	padding: 14px;
	border: 3px solid var(--muted);
}

.notice ul {
	margin-top: 8px;
	padding-left: 20px;
	list-style: square;
}

/* Flags: something the author has to read before going on. Red breaks the rules, yellow is an assumption;
   the mark (X or !) and the title say the same without colour. */
.flag {
	--flag: var(--caution);
	padding: 14px;
	border: 4px solid var(--flag);
}

.flag-violation {
	--flag: var(--alert);
}

.flag + .flag,
.flag + .notice {
	margin-top: 12px;
}

.flag-head {
	display: flex;
	align-items: center;
	gap: 12px;
}

.flag-mark {
	flex: none;
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	background: var(--flag);
	color: var(--bg);
	font-family: var(--font-display);
	font-size: 16px;
	line-height: 1;
}

.flag-title {
	color: var(--flag);
	font-family: var(--font-display);
	font-size: 13px;
	font-weight: 400;
	line-height: 1.4;
	text-transform: uppercase;
}

.flag ul {
	padding-left: 20px;
	list-style: square;
}

.flag li::marker {
	color: var(--flag);
}

.flag-instead {
	color: var(--muted);
}

/* Sample matches in the preview: the one being played stands out, the ones still to come are dimmed. */
.preview-match.is-waiting {
	opacity: 0.4;
}

.preview-match.is-playing .preview-caption {
	color: var(--fg);
}

/* Only the match being played says where it is, so the preview keeps its height from start to end. */
.preview-match:not(.is-playing) .preview-caption {
	display: none;
}

.flag-gate {
	margin-top: 12px;
}

/* Working: shown while rules are being written from a description. Lit blocks march along the row. */
.working {
	display: grid;
	gap: 10px;
	padding: 14px;
	border: 3px solid var(--fg);
}

.working-blocks {
	display: flex;
	gap: 6px;
}

.working-blocks span {
	width: 18px;
	height: 18px;
	border: 3px solid var(--fg);
	animation: working 1.6s steps(1) infinite;
}

.working-blocks span:nth-child(2) { animation-delay: 0.2s; }
.working-blocks span:nth-child(3) { animation-delay: 0.4s; }
.working-blocks span:nth-child(4) { animation-delay: 0.6s; }
.working-blocks span:nth-child(5) { animation-delay: 0.8s; }
.working-blocks span:nth-child(6) { animation-delay: 1s; }
.working-blocks span:nth-child(7) { animation-delay: 1.2s; }
.working-blocks span:nth-child(8) { animation-delay: 1.4s; }

.working-title {
	font-family: var(--font-display);
	font-size: 13px;
	line-height: 1.4;
	text-transform: uppercase;
}

.working-caret {
	display: inline-block;
	width: 10px;
	height: 13px;
	margin-left: 6px;
	vertical-align: baseline;
	background: var(--fg);
	animation: blink 0.8s steps(1) infinite;
}

@keyframes working {
	0% {
		background: var(--fg);
	}
	25% {
		background: transparent;
	}
}

/* A strategy that was just created, shown off: built block by block, then turning on the spot. */
.fighter {
	align-items: center;
	text-align: center;
}

.fighter-stand {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	padding-top: 16px;
}

.fighter-floor {
	width: 256px;
	max-width: 100%;
	border-top: 8px dashed var(--fg);
}

.fighter-stand.is-ready .fighter-turn {
	animation: fighter-turn 4.8s steps(1) infinite;
}

.fighter-name {
	font-family: var(--font-display);
	font-size: 18px;
	line-height: 1.5;
	text-transform: uppercase;
	overflow-wrap: anywhere;
}

.fighter-actions {
	justify-content: center;
}

/* A turn in pixel steps: the figure narrows to a sliver (side on) and widens again, twice for a full turn,
   with a small hop when it faces front again; then it stands still for a moment. */
@keyframes fighter-turn {
	0% { transform: scaleX(1); }
	3% { transform: scaleX(0.75); }
	6% { transform: scaleX(0.45); }
	9% { transform: scaleX(0.12); }
	12% { transform: scaleX(0.45); }
	15% { transform: scaleX(0.75); }
	18% { transform: scaleX(1); }
	21% { transform: scaleX(0.75); }
	24% { transform: scaleX(0.45); }
	27% { transform: scaleX(0.12); }
	30% { transform: scaleX(0.45); }
	33% { transform: scaleX(0.75); }
	36% { transform: translateY(-8px); }
	40% { transform: none; }
	100% { transform: none; }
}

/* --- profile --- */

.meter {
	max-width: 640px;
	height: 26px;
	border: 3px solid var(--fg);
}

.meter > div {
	height: 100%;
	background: var(--fg);
}

.btn-name {
	max-width: 22ch;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	display: inline-block;
	line-height: 30px;
}

/* --- strategies and the editor --- */

.code {
	margin: 0;
	padding: 12px;
	max-width: 100%;
	max-height: 360px;
	overflow: auto;
	border: 3px solid var(--muted);
	font: inherit;
	tab-size: 2;
}

.editor {
	max-width: 860px;
}

/* A sentence made of words and small controls: "Go to [state] when [condition]". */
.sentence {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.sentence select,
.sentence input {
	width: auto;
	max-width: 100%;
}

.sentence input[type='number'] {
	width: 84px;
}

.sentence input[type='text'] {
	width: 200px;
}

.moves {
	padding-left: 14px;
	border-left: 3px solid var(--muted);
}

.move {
	padding: 12px 0;
	border-top: 3px dashed var(--muted);
}

.move:first-child {
	border-top: 0;
	padding-top: 0;
}

.mode-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 24px;
	max-width: 860px;
}

/* --- avatars --- */

.avatar {
	display: block;
	flex: none;
	fill: currentColor;
}

.avatar-name {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	vertical-align: middle;
}

.avatar-heading {
	display: flex;
	align-items: center;
	gap: 14px;
}

.matrix-head {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 4px 0;
}

.match-side > .avatar {
	color: var(--fg);
}

/* --- landing page --- */

.landing-hero {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 24px;
	/* The first screen is the hero and nothing else: the window minus the header and the page padding. */
	min-height: calc(100svh - var(--header-height, 71px) - var(--gutter));
	padding: 24px 0;
	text-align: center;
}

/* Magnetic screens: on every page (the front page and How it works have screens of their own make), letting go of a scroll settles on the
   nearest screen, never in between. The first screen sits under the header, so it settles by its
   bottom edge (the top of the page); every other one by its top edge. A screen taller than the
   window can still be scrolled through. */
html:has(.landing),
html:has(.screens) {
	scroll-snap-type: y proximity; /* narrow windows: screens can be taller than the window, so only a gentle pull */
}

@media (min-width: 901px) {
	html:has(.landing),
	html:has(.screens) {
		scroll-snap-type: y mandatory;
	}
}

.landing-hero,
.how-top {
	scroll-snap-align: end;
}

.landing-screen,
.how-screen:not(.how-top) {
	scroll-snap-align: start;
}

/* On the front page every step is a screen of its own, with its content in the middle. */
.landing-screen {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: 100svh;
	padding-block: 24px;
}

/* Sized so that the match between two strategies fits one screen. */
.landing-screen .lab {
	gap: 16px;
}

.landing-screen .match-score {
	font-size: clamp(36px, 8vw, 56px);
}

@media (min-width: 721px) {
	.landing-screen .lab-picks {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.hero-title {
	font: 400 clamp(18px, 2.8vw, 28px) / 1.6 var(--font-display);
	text-transform: uppercase;
}

.lead {
	max-width: 44ch;
	font-size: 16px;
}

.landing-section {
	padding: 48px 0;
	border-top: 6px dashed var(--fg);
}

.landing-close {
	align-items: center;
	text-align: center;
}

.figures {
	display: grid;
	gap: 40px 32px;
}

.figures.two {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reasons {
	max-width: 860px;
}

.avatar-wall {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 16px;
	max-width: 520px;
}

.pay-table td.is-on {
	background: var(--fg);
	color: var(--bg);
}

/* Films: a framed screen whose chapters play one after another, with captions, next to the list of chapters. */

.film {
	display: grid;
	grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
	align-items: start;
	gap: 24px 40px;
}

.film-screen {
	display: flex;
	flex-direction: column;
	border: 3px solid var(--fg);
}

.film-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 12px;
	border-bottom: 3px dashed var(--fg);
}

.film-state {
	display: flex;
	align-items: center;
	gap: 8px;
}

.film-light {
	width: 10px;
	height: 10px;
	border: 3px solid var(--fg);
}

.film.is-playing .film-light {
	background: var(--fg);
	animation: blink 1s steps(1) infinite;
}

.film-segments {
	display: flex;
	gap: 4px;
}

.film-seg {
	width: 36px;
	height: 12px;
	border: 3px solid var(--fg);
}

.film-fill {
	display: block;
	width: 0;
	height: 100%;
	background: var(--fg);
}

.film-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	text-align: center;
}

.film-card-title {
	font: clamp(16px, 2.6vw, 24px) / 1.5 var(--font-display);
	text-transform: uppercase;
}

.film-caret {
	display: inline-block;
	width: 8px;
	height: 14px;
	margin-left: 3px;
	vertical-align: text-bottom;
	background: var(--fg);
}

.film.is-playing .film-caret {
	animation: blink 0.7s steps(1) infinite;
}

.film.is-paused .scene-stage {
	opacity: 0.5;
}

/* Signs of life: what is playing blinks and hops, in hard steps like everything else here. */

@keyframes blink {
	50% {
		opacity: 0;
	}
}

@keyframes hop {
	50% {
		transform: translateY(-3px);
	}
}

.film.is-playing .scene-stage .avatar,
.film.is-playing .film-card-title {
	animation: blink 0.5s steps(1) 2;
}

.film.is-playing .duel-right .avatar,
.film.is-playing .board-row:nth-child(even) .avatar,
.film.is-playing .run-row:nth-child(even) .avatar {
	animation-delay: 0.45s;
}

.film-screen .scene-stage {
	flex: none;
	height: 300px;
	padding: 16px;
	overflow: hidden;
}

.film-caption {
	min-height: 72px; /* three lines, so the screen keeps its size as captions change */
	padding: 12px 16px 0;
	border-top: 3px solid var(--fg);
}

.film-chapters {
	display: flex;
	flex-direction: column;
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.film-pick {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 44px;
	padding: 0;
	background: none;
	border: 0;
	color: var(--fg);
	font: 13px/1.5 var(--font-display);
	text-transform: uppercase;
	text-align: left;
	cursor: pointer;
}

.film-pick-no {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 32px;
	height: 32px;
	border: 3px solid var(--fg);
	font-size: 11px;
}

.film-pick[aria-current] .film-pick-no,
.film-pick:hover .film-pick-no {
	background: var(--fg);
	color: var(--bg);
}

.film-chapters p {
	padding-left: 44px;
	color: var(--muted);
}

.film-chapters li:has([aria-current]) p {
	color: var(--fg);
}

.pay-cell.wide {
	min-width: 44px;
	padding: 8px 6px;
	font-size: 12px;
	text-align: center;
}

.pay-cell.is-on {
	background: var(--fg);
	color: var(--bg);
}

/* Scenes: small pictures that play in a loop. Everything inside is decorative. */

.scene {
	display: flex;
	min-width: 0;
	padding: 16px;
	border: 3px solid var(--fg);
}

.scene-stage {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	min-width: 0;
}

.scene .off,
.film-screen .off {
	visibility: hidden;
}

.px {
	font: 9px/1.6 var(--font-display);
	text-transform: uppercase;
}

.px.dim {
	color: var(--muted);
}

.scene-status {
	min-height: 15px;
	color: var(--muted);
	text-align: center;
}

.chip {
	display: inline-block;
	flex: none;
	width: 14px;
	height: 14px;
	border: 3px solid var(--ghost);
}

.chip.big {
	width: 20px;
	height: 20px;
}

.chip[data-move='C'] {
	background: var(--coop);
	border-color: var(--coop);
}

.chip[data-move='D'] {
	background: var(--defect);
	border-color: var(--defect);
}

.mini-strip {
	display: flex;
	gap: 4px;
}

.mini-round {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.rule-card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.rule-line {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 3px 6px;
}

.rule-line.top {
	align-items: flex-start;
}

.rule-line.is-on {
	background: var(--fg);
	color: var(--bg);
}

/* On the white highlight a move square keeps its colour inside a black frame. */
.rule-line.is-on .chip[data-move] {
	outline: 2px solid var(--bg);
}

.px.strong {
	font-size: 11px;
}

/* Two players across the centre line. */

.duel {
	display: flex;
	align-items: stretch;
	align-self: stretch;
}

.duel-side {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 12px;
}

.duel-left {
	justify-content: flex-end;
	padding-right: 14px;
}

.duel-right {
	justify-content: flex-start;
	padding-left: 14px;
}

.duel-info {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	min-width: 0;
	text-align: center;
}

.duel-name {
	display: flex;
	align-items: center;
	min-height: 34px;
	padding: 2px 6px;
	overflow-wrap: anywhere;
}

.duel-name.is-winner {
	background: var(--fg);
	color: var(--bg);
}

.duel-score {
	min-height: 28px;
	font: clamp(18px, 3vw, 28px) / 1 var(--font-display);
	font-variant-numeric: tabular-nums;
}

.duel .centre-line {
	border-left-width: 6px;
}

/* A move on its way to the line. */
.shot {
	opacity: 0;
	--from: -36px;
	transform: translateX(var(--from));
}

.duel-right .shot {
	--from: 36px;
}

.shot.fly {
	opacity: 1;
	transform: none;
	transition: transform 0.24s steps(4);
}

.card-slot {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
}

.chip.card {
	width: 36px;
	height: 36px;
}

.card-mark {
	position: absolute;
	color: var(--muted);
	font-size: 12px;
}

/* A world. */

.mini-field {
	display: flex;
	align-items: center;
	justify-content: space-around;
	width: 100%;
	max-width: 200px;
	height: 56px;
	border: 3px solid var(--fg);
}

.mini-line {
	align-self: stretch;
	border-left: 4px dashed var(--fg);
}

.pay-grid {
	display: grid;
	grid-template-columns: auto auto auto;
	align-items: center;
	justify-items: center;
	gap: 6px 10px;
}

.pay-cell {
	padding: 4px 6px;
	border: 3px solid var(--fg);
	white-space: nowrap;
}

.world-tiles {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
	align-self: stretch;
}

.world-tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 10px 6px;
	border: 3px solid var(--fg);
	outline: 3px dashed transparent;
	outline-offset: 3px;
}

.world-tile.is-soon {
	border-color: var(--muted);
	color: var(--muted);
}

.world-tile.has-cursor {
	outline-color: var(--fg);
}

.world-tile.is-picked {
	background: var(--fg);
	color: var(--bg);
}

.world-tile.is-picked .mini-field,
.world-tile.is-picked .mini-line,
.world-tile.is-picked .chip {
	border-color: var(--bg);
}

.world-tile.is-picked .chip[data-move='C'] {
	background: var(--bg);
}

.world-glyph {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 56px;
}

.world-glyph .mini-field {
	height: 48px;
}

.world-tile.is-soon .chip {
	border-color: var(--muted);
}

.glyph-three {
	display: grid;
	grid-template-columns: 14px 14px 14px;
	gap: 6px 0;
}

.glyph-three .chip:first-child {
	grid-column: 2;
}

.glyph-three .chip:nth-child(2) {
	grid-column: 1;
}

.glyph-three .chip:nth-child(3) {
	grid-column: 3;
}

.glyph-crowd {
	display: grid;
	grid-template-columns: repeat(3, 8px);
	gap: 8px;
}

.dot {
	width: 8px;
	height: 8px;
	background: var(--muted);
}

/* A strategy. */

.strategy-head {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	max-width: 100%;
}

.io {
	display: grid;
	grid-template-columns: auto auto;
	align-items: center;
	gap: 6px 12px;
}

.io-row {
	display: flex;
	gap: 6px;
}

.type-box {
	align-self: stretch;
	min-height: 72px;
	padding: 8px 10px;
	border: 3px solid var(--fg);
	font-size: 13px;
}

.caret {
	display: inline-block;
	width: 8px;
	height: 14px;
	margin-left: 2px;
	vertical-align: text-bottom;
	background: var(--fg);
}

.arrow {
	fill: currentColor;
}

/* Rankings and runs. */

.board,
.run-rows {
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-self: stretch;
}

.board-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 3px 6px;
	outline: 3px dashed transparent;
}

.board-row.is-playing,
.run-row.is-playing {
	outline-color: var(--fg);
}

.board-row.is-you .board-rank,
.board-row.is-top .board-rank {
	background: var(--fg);
	color: var(--bg);
}

.board-rank {
	width: 16px;
	min-height: 15px;
	text-align: center;
}

.board-track {
	flex: 1;
	min-width: 0;
}

.board-track .bar {
	display: block;
	height: 16px;
	transition: width 0.4s steps(8);
}

.board-score {
	width: 30px;
	text-align: right;
}

.run-you {
	display: flex;
	align-items: center;
	gap: 10px;
}

.run-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 4px 6px;
	outline: 3px dashed transparent;
}

.run-score {
	width: 50px;
}

/* Front page: the five-round game against a talking opponent. */

.btn-big {
	padding: 16px 24px;
}

/* How it works: every section is one screen. It fills the window, and its film is sized from the
   window's height so that heading, film and legend fit inside it. */
.how-screen {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: 100svh;
	padding-block: 24px;
	--stage: 300px; /* the films are drawn for at least this much */
}

.how-screen.how-top {
	min-height: calc(100svh - var(--header-height, 71px) - var(--gutter));
	padding-block: 0;
}

/* Side by side (film next to its chapters), a taller window gets a taller film. */
@media (min-width: 901px) {
	.how-screen {
		--stage: clamp(300px, 100svh - 420px, 440px);
	}
}

.how-screen .film-screen .scene-stage {
	height: var(--stage);
}

/* Only the chapter on show keeps its description, so the list stays shorter than the screen. */
.how-screen .film-chapters li:not(:has([aria-current])) p {
	display: none;
}

.how-screen .film-chapters {
	gap: 12px;
}

.talk {
	display: flex;
	align-items: flex-start;
	gap: 24px;
}

.talk-who {
	display: flex;
	flex: none;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	min-width: 96px;
}

.talk-face.is-talking {
	animation: hop 0.18s steps(2) 3;
}

/* A speech bubble: a bordered box with a blocky tail towards the speaker. */
.bubble {
	position: relative;
	max-width: 52ch;
	min-height: 76px;
	padding: 14px 16px;
	border: 3px solid var(--fg);
	font-size: 16px;
}

.bubble::before,
.bubble::after {
	content: '';
	position: absolute;
	background: var(--fg);
}

.bubble::before {
	top: 22px;
	left: -13px;
	width: 10px;
	height: 10px;
}

.bubble::after {
	top: 30px;
	left: -21px;
	width: 6px;
	height: 6px;
}

.hand-table {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 32px;
	margin-top: 28px;
	padding-top: 28px;
	border-top: 3px dashed var(--fg);
}

.hand-track {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* One lane per side: who, the five rounds, the total. The visitor's lane is the lit one. */
.hand-heads,
.hand-lane {
	display: grid;
	grid-template-columns: 132px auto 1fr;
	align-items: center;
	gap: 16px;
	padding: 12px 14px;
	border-left: 6px solid transparent;
}

.hand-heads {
	padding-block: 0;
	color: var(--muted);
}

.hand-lane {
	border-left-color: var(--ghost);
}

.hand-lane.is-you,
.hand-yours {
	border-left: 6px solid var(--fg);
	background: var(--lane);
}

.hand-yours {
	padding: 16px;
}

.hand-who {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	overflow-wrap: anywhere;
}

.you-tag {
	display: inline-block;
	padding: 6px 8px;
	background: var(--fg);
	color: var(--bg);
}

.hand-cell {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: 34px;
	text-align: center;
}

/* A move square that says its move: C or D. */
.chip.say {
	display: inline-grid;
	place-items: center;
	color: var(--bg);
	font: 400 10px/1 var(--font-display);
}

.chip.say[data-move]::before {
	content: attr(data-move);
}

.btn .chip.say {
	width: 26px;
	height: 26px;
}

.btn-move {
	display: inline-flex;
	align-items: center;
	gap: 12px;
}

/* Points won per round, under the square that won them. */
.hand-gain {
	min-height: 12px;
	color: var(--muted);
	font: 400 9px/1.3 var(--font-display);
}

.hand-gain.is-draw,
.hand-gain.is-winner {
	color: var(--fg);
}

/* Whoever won the round gets a white outline around its square. */
.hand-row .chip.is-winner {
	border-color: var(--fg);
}

.hand-total {
	display: flex;
	align-items: center;
	gap: 12px;
}

.hand-score {
	padding: 6px 8px;
	border: 3px solid transparent;
}

/* Raised: whoever leads on the total, or won the match, stands out from the field. */
.hand-score.is-leading {
	transform: translate(-2px, -2px);
	border-color: var(--fg);
	background: var(--fg);
	color: var(--bg);
	box-shadow: var(--raise) var(--raise) 0 var(--muted);
}

.match-score.is-winner {
	transform: translate(-3px, -3px);
	text-shadow: 6px 6px 0 #6b6b6b;
}

.hand-row {
	display: flex;
	gap: 8px;
}

.hand-row .chip.big {
	width: 34px;
	height: 34px;
	font-size: 12px;
}

.hand-row .chip.is-next {
	border-style: dashed;
	border-color: var(--fg);
}

.hand-score {
	font: 400 16px/1 var(--font-display);
}

.hand-result {
	padding-left: 12px;
	border-left: 3px solid var(--fg);
}

.hand-points {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 2px 16px;
	margin: 0;
}

.stack-xs {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.lab-pick:has(input:checked) .meta {
	color: var(--bg);
}

/* Front page: the ranking of the classics, and the three steps. */

.rank-list {
	display: grid;
	gap: 12px;
	max-width: 760px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rank-row {
	display: grid;
	grid-template-columns: 20px minmax(0, 220px) minmax(0, 1fr) 56px;
	align-items: center;
	gap: 12px;
}

.rank-track .bar {
	display: block;
	height: 14px;
}

.rank-score {
	font: 400 14px/1 var(--font-display);
	text-align: right;
}

.steps {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.step {
	padding: 16px;
	border: 3px solid var(--fg);
}

.step-pic {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 84px;
	margin-bottom: 8px;
	border: 3px dashed var(--ghost);
	text-align: center;
}

.step-strip {
	display: flex;
	gap: 4px;
}

/* Try it: the classics. */

.lab-picks {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.lab-pick {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	padding: 4px 10px;
	border: 3px solid var(--fg);
	cursor: pointer;
}

.lab-pick:has(input:checked) {
	background: var(--fg);
	color: var(--bg);
}

.lab-pick:has(input:focus-visible) {
	outline: 3px dashed var(--fg);
	outline-offset: 3px;
}

.lab-who {
	display: flex;
	flex-direction: column;
	align-items: inherit;
	gap: 12px;
}

@media (prefers-reduced-motion: reduce) {
	.fixtures.is-wiping,
	.working-blocks span,
	.working-caret,
	.fighter-turn,
	.landing .avatar,
	.talk-face,
	.film-light,
	.film-caret,
	.film-card-title {
		animation: none !important;
	}

	.shot.fly,
	.board-track .bar {
		transition: none;
	}
}

@media (max-width: 900px) {
	.film {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* --- phone width --- */

@media (max-width: 720px) {
	:root {
		--gutter: 16px;
	}

	.hand-table,
	.steps {
		grid-template-columns: minmax(0, 1fr);
	}

	.hand-heads,
	.hand-lane {
		grid-template-columns: auto 1fr;
		gap: 10px 16px;
	}

	.hand-who,
	.hand-heads > :first-child {
		grid-column: 1 / -1;
	}

	.talk {
		gap: 20px;
	}

	.talk-who {
		min-width: 64px;
	}

	.talk-who .avatar {
		width: 56px;
		height: 56px;
	}

	.bubble {
		font-size: 14px;
	}

	.rank-row {
		grid-template-columns: 20px minmax(0, 1fr) 48px;
	}

	.rank-track {
		display: none;
	}

	.match-left {
		padding-right: 12px;
	}

	.match-right {
		padding-left: 12px;
	}

	.match-name {
		font-size: 11px;
	}

	.centre-line {
		border-left-width: 6px;
	}

	.card {
		padding: 14px;
	}

	.card.fold {
		padding: 0;
	}

	.fold > details > summary {
		flex-wrap: wrap;
		padding: 10px 14px;
	}

	.fold-body {
		padding: 6px 14px 14px;
	}

	.rules {
		grid-template-columns: minmax(0, 1fr);
		gap: 2px;
	}

	.rules dd {
		margin-bottom: 10px;
	}

	.figures.two {
		grid-template-columns: minmax(0, 1fr);
	}

	.landing-section {
		padding: 36px 0;
	}

	.scene {
		padding: 12px 8px;
	}

	.film-screen .scene-stage {
		padding: 12px 8px;
	}

	.film-seg {
		width: 24px;
	}

	.film-caption {
		min-height: 96px;
		padding: 10px 10px 0;
	}

	.duel-left {
		padding-right: 8px;
	}

	.duel-right {
		padding-left: 8px;
	}

	.duel-side {
		gap: 6px;
	}
}

/* Shown instead of the app when JavaScript is off. A class, not a style attribute: the site's content policy allows no inline styles. */
.noscript {
	padding: 32px;
}
