/* JoyBlox: dark bar, warm yellow for play and sign-up, neutral pages that let
   the games' pictures carry the colour. Figtree throughout. */

@font-face {
	font-family: "Figtree";
	font-style: normal;
	font-weight: 300 900;
	font-display: swap;
	src: url("/static/figtree.woff2?v=4ba7d3d09669") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Figtree";
	font-style: normal;
	font-weight: 300 900;
	font-display: swap;
	src: url("/static/figtree-ext.woff2?v=bf7828e2c258") format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
	--joy: #ffc629;
	--joy-hover: #ffb703;
	--joy-ink: #14161a;
	--bar: #14161a;
	--bar-ink: #f4f5f7;
	--bar-muted: #a9aeb8;
	--bar-field: #272a31;
	--bar-edge: transparent;
	--bg: #f2f3f5;
	--surface: #ffffff;
	--ink: #14161a;
	--muted: #5a606c;
	--line: #e1e3e8;
	--line-strong: #c4c8d0;
	--hover: #e8eaee;
	--focus: #2563eb;
	--live: #0e7a45;
	--ok-bg: #e3f4ea;
	--ok-ink: #0b5530;
	--error-bg: #fde7e4;
	--error-ink: #8c1d12;
	--code-bg: #1b1d22;
	--code-ink: #e8eaee;
	--shadow: 0 10px 30px rgb(20 22 26 / 0.16);
	--radius: 10px;
	--content: 1240px;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bar: #0b0c0e;
		--bar-field: #1f2127;
		--bar-edge: #24262c;
		--bg: #111215;
		--surface: #1a1c20;
		--ink: #eef0f3;
		--muted: #a3a8b3;
		--line: #2a2d33;
		--line-strong: #3d4149;
		--hover: #24272c;
		--focus: #6b9bff;
		--live: #4cc38a;
		--ok-bg: #12301f;
		--ok-ink: #a6e6c2;
		--error-bg: #3a1714;
		--error-ink: #ffb4aa;
		--code-bg: #0b0c0e;
		--shadow: 0 10px 30px rgb(0 0 0 / 0.5);
		color-scheme: dark;
	}
}

/* Colours of their own for games without a picture and for users' initials. */
.tone-0 { --tone: #2f5be0; }
.tone-1 { --tone: #cf3d2c; }
.tone-2 { --tone: #0e7f5d; }
.tone-3 { --tone: #6a44c4; }
.tone-4 { --tone: #b65400; }
.tone-5 { --tone: #08779a; }
.tone-6 { --tone: #b0306a; }
.tone-7 { --tone: #3e4656; }

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--ink);
	font: 400 16px/1.5 "Figtree", system-ui, sans-serif;
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
code, pre { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace; font-size: 0.875em; }

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

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

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

/* Top bar */

.bar {
	position: sticky;
	top: 0;
	z-index: 10;
	display: grid;
	grid-template-columns: auto auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 28px;
	height: 64px;
	padding: 0 24px;
	border-bottom: 1px solid var(--bar-edge);
	background: var(--bar);
	color: var(--bar-ink);
}

.logo {
	display: flex;
	align-items: center;
	gap: 8px;
	text-decoration: none;
	color: var(--bar-ink);
}

.logo-mark { width: 34px; height: 34px; }
.logo-name { font-size: 22px; font-weight: 850; letter-spacing: -0.01em; }

.bar-nav { display: flex; gap: 4px; }

.bar-nav a {
	padding: 8px 12px;
	border-radius: 8px;
	color: var(--bar-muted);
	font-weight: 650;
	text-decoration: none;
}

.bar-nav a:hover { color: var(--bar-ink); background: var(--bar-field); }
.bar-nav a[aria-current="page"] { color: var(--bar-ink); box-shadow: inset 0 -3px 0 var(--joy); border-radius: 8px 8px 0 0; }

.bar-search {
	position: relative;
	justify-self: center;
	width: 100%;
	max-width: 520px;
}

.bar-search .icon {
	position: absolute;
	left: 12px;
	top: 50%;
	translate: 0 -50%;
	color: var(--bar-muted);
	pointer-events: none;
}

.bar-search input {
	width: 100%;
	height: 40px;
	padding: 0 14px 0 40px;
	border: 1px solid transparent;
	border-radius: 8px;
	background: var(--bar-field);
	color: var(--bar-ink);
}

.bar-search input::placeholder { color: var(--bar-muted); }
.bar-search input:focus { border-color: var(--bar-muted); outline: none; }

.bar-account { display: flex; align-items: center; gap: 8px; }

/* Account menu */

.menu { position: relative; }

.menu summary {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 4px 8px 4px 4px;
	border-radius: 999px;
	cursor: pointer;
	list-style: none;
	font-weight: 650;
}

.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: var(--bar-field); }
.menu summary .icon { width: 16px; height: 16px; color: var(--bar-muted); }

.menu-list {
	position: absolute;
	right: 0;
	top: calc(100% + 8px);
	min-width: 190px;
	padding: 6px;
	border-radius: 12px;
	background: var(--surface);
	color: var(--ink);
	box-shadow: var(--shadow);
}

.menu-list a, .menu-list button {
	display: block;
	width: 100%;
	padding: 9px 12px;
	border: 0;
	border-radius: 8px;
	background: none;
	text-align: left;
	text-decoration: none;
	font-weight: 550;
	cursor: pointer;
}

.menu-list a:hover, .menu-list button:hover { background: var(--hover); }
.menu-list form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }

/* Buttons */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 40px;
	padding: 0 16px;
	border: 1px solid transparent;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}

.btn-joy { background: var(--joy); color: var(--joy-ink); }
.btn-joy:hover { background: var(--joy-hover); }
.btn-ink { background: var(--ink); color: var(--bg); }
.btn-ink:hover { opacity: 0.88; }
.btn-quiet { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-quiet:hover { background: var(--hover); }
.btn-quiet-dark { color: var(--bar-ink); border-color: #3a3e46; }
.btn-quiet-dark:hover { background: var(--bar-field); }
.btn-block { width: 100%; height: 46px; font-size: 16px; }
.btn-small { height: 32px; padding: 0 12px; font-size: 14px; }
.btn:active, .btn-play:active { translate: 0 1px; }

/* Page */

.main {
	flex: 1;
	width: 100%;
	max-width: var(--content);
	margin: 0 auto;
	padding: 32px 24px 64px;
}

.main.narrow { max-width: 560px; }

.page-title { font-size: 30px; font-weight: 850; letter-spacing: -0.015em; margin-bottom: 24px; }
.muted { color: var(--muted); }
.lede { max-width: 68ch; color: var(--muted); margin-bottom: 24px; }
.link-quiet { color: var(--muted); font-weight: 600; text-decoration: none; }
.link-quiet:hover { color: var(--ink); text-decoration: underline; }

.shelf + .shelf { margin-top: 48px; }
.shelf h2, .section-head h2 { font-size: 21px; font-weight: 800; margin-bottom: 16px; }

.section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 8px;
}

.section-head h2 { margin: 0; }

.empty {
	padding: 40px 24px;
	border-radius: 14px;
	background: var(--surface);
	color: var(--muted);
	text-align: center;
}

.empty .btn { margin-top: 16px; }

.empty-page { padding: 64px 0; text-align: center; }
.empty-page h1 { font-size: 30px; font-weight: 850; margin-bottom: 8px; }
.empty-page p { color: var(--muted); margin-bottom: 24px; }

.footer {
	width: 100%;
	max-width: var(--content);
	margin: 0 auto;
	padding: 24px;
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: 14px;
}

/* Game cards */

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

.card a { display: block; text-decoration: none; }

.card .thumb { transition: translate 120ms ease-out; }
.card a:hover .thumb { translate: 0 -3px; }
.card a:hover .card-name { text-decoration: underline; }

.card-name {
	display: -webkit-box;
	margin-top: 10px;
	overflow: hidden;
	font-weight: 700;
	line-height: 1.3;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.card-meta {
	display: flex;
	align-items: center;
	gap: 5px;
	margin-top: 4px;
	color: var(--muted);
	font-size: 14px;
}

.card-meta .icon { width: 14px; height: 14px; }
.card-meta.live { color: var(--live); font-weight: 650; }

/* A game's picture, or its name as a poster */

.thumb {
	position: relative;
	overflow: hidden;
	border-radius: 12px;
	background: var(--hover);
	container-type: inline-size;
}

.thumb-square { aspect-ratio: 1; }
.thumb-wide { aspect-ratio: 16 / 9; border-radius: 16px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.poster {
	background: var(--tone);
	color: #fff;
}

.poster::before {
	content: "";
	position: absolute;
	right: -16%;
	top: -16%;
	width: 62%;
	aspect-ratio: 1;
	border-radius: 22%;
	background: rgb(255 255 255 / 0.14);
	rotate: -8deg;
}

/* Sized by the thumbnail (a size container), so the initials scale with the card. */
.poster span {
	position: absolute;
	left: 8cqw;
	bottom: 4cqw;
	font-size: 36cqw;
	font-weight: 850;
	line-height: 1;
	letter-spacing: -0.03em;
}

.thumb-wide.poster span { left: 5cqw; bottom: 1cqw; font-size: 24cqw; }

/* Game page */

.game {
	display: grid;
	grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
	gap: 36px;
	align-items: start;
}

.game-title { font-size: 36px; font-weight: 850; letter-spacing: -0.02em; line-height: 1.1; }
.game-by { margin-top: 8px; color: var(--muted); }
.game-by a { color: var(--ink); font-weight: 650; text-decoration: none; }
.game-by a:hover { text-decoration: underline; }
.game-side .tag { margin-top: 12px; }

.play { margin: 0; }

.btn-play {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	height: 64px;
	margin-top: 24px;
	border: 0;
	border-radius: 12px;
	background: var(--joy);
	color: var(--joy-ink);
	font-size: 21px;
	font-weight: 850;
	text-decoration: none;
	cursor: pointer;
}

.btn-play:hover { background: var(--joy-hover); }
.btn-play .icon { width: 24px; height: 24px; }
.btn-play:disabled { opacity: 0.7; cursor: progress; }

.play-error { min-height: 1.5em; margin-top: 8px; color: var(--error-ink); font-weight: 600; }
.play-error:empty { min-height: 0; margin: 0; }

.stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin: 24px 0;
}

.stats div { padding-top: 12px; border-top: 1px solid var(--line); }
.stats dt, .facts dt { color: var(--muted); font-size: 14px; }
.stats dd { margin: 2px 0 0; font-size: 19px; font-weight: 800; }

.about { margin-top: 48px; max-width: 820px; }
.about h2 { font-size: 21px; font-weight: 800; margin-bottom: 12px; }
.description { max-width: 70ch; white-space: pre-line; overflow-wrap: anywhere; }

.facts { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 24px 0 0; }
.facts dd { margin: 0; font-weight: 650; }

.play-dialog {
	width: min(440px, calc(100% - 32px));
	padding: 28px;
	border: 0;
	border-radius: 16px;
	background: var(--surface);
	color: var(--ink);
	box-shadow: var(--shadow);
}

.play-dialog::backdrop { background: rgb(8 9 11 / 0.55); }
.play-dialog h2 { font-size: 22px; font-weight: 850; margin-bottom: 8px; }
.play-dialog p { color: var(--muted); }
.dialog-actions { display: flex; gap: 8px; margin-top: 24px; }

/* Profile */

.profile { display: flex; align-items: center; gap: 24px; margin-bottom: 40px; }
.profile-name { font-size: 32px; font-weight: 850; letter-spacing: -0.015em; }
.profile-handle { color: var(--muted); font-weight: 600; margin-bottom: 4px; }

.avatar {
	display: inline-grid;
	place-items: center;
	flex: none;
	border-radius: 50%;
	background: var(--tone);
	color: #fff;
	font-weight: 800;
}

.avatar-sm { width: 32px; height: 32px; font-size: 15px; }
.avatar-lg { width: 112px; height: 112px; font-size: 48px; }
.menu-name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Forms */

.panel {
	margin: 24px auto 0;
	padding: 36px 32px 28px;
	border-radius: 18px;
	background: var(--surface);
}

.panel h1 { font-size: 26px; font-weight: 850; letter-spacing: -0.01em; margin-bottom: 24px; }
.panel-foot { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; }
.panel-foot a { color: var(--ink); font-weight: 700; }

.form { display: grid; gap: 18px; }
.form .btn-block { margin-top: 6px; }

.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field label, .field legend { font-weight: 700; font-size: 15px; padding: 0; }
.field legend { margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 14px; }

.field input:not([type="radio"], [type="file"]), .field textarea {
	width: 100%;
	min-height: 44px;
	padding: 9px 12px;
	border: 1px solid var(--line-strong);
	border-radius: 8px;
	background: var(--surface);
}

.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus { border-color: var(--focus); outline: 3px solid color-mix(in srgb, var(--focus) 28%, transparent); outline-offset: 0; }
.field input[type="number"] { max-width: 160px; }
.field input[type="file"] { padding: 6px 0; }

.field input[type="file"]::file-selector-button {
	height: 36px;
	margin-right: 12px;
	padding: 0 14px;
	border: 1px solid var(--line-strong);
	border-radius: 8px;
	background: var(--surface);
	color: var(--ink);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.field .choice { display: flex; align-items: baseline; gap: 10px; padding: 4px 0; font-weight: 500; }
.choice input { accent-color: var(--ink); }

.notice { margin-bottom: 20px; padding: 12px 16px; border-radius: 10px; font-weight: 600; }
.notice-error { background: var(--error-bg); color: var(--error-ink); }
.notice-ok { background: var(--ok-bg); color: var(--ok-ink); }

/* Create */

.create-head { margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.create-head .page-title { margin-bottom: 16px; }

.tabs { display: flex; gap: 24px; }

.tabs a {
	padding: 0 0 12px;
	color: var(--muted);
	font-weight: 700;
	text-decoration: none;
}

.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -3px 0 var(--ink); }

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

.row {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr) auto;
	align-items: center;
	gap: 16px;
	padding: 14px 0;
	border-bottom: 1px solid var(--line);
}

.row-thumb .thumb { border-radius: 10px; }
.row-name { font-size: 17px; font-weight: 750; text-decoration: none; }
.row-name:hover { text-decoration: underline; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 4px; color: var(--muted); font-size: 14px; }

.tag {
	display: inline-block;
	padding: 2px 9px;
	border-radius: 999px;
	background: var(--hover);
	color: var(--muted);
	font-size: 13px;
	font-weight: 700;
}

.tag-live { background: var(--ok-bg); color: var(--ok-ink); }

.settings-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px; margin-bottom: 20px; }
.settings-title { flex: 1 0 auto; order: -1; width: 100%; font-size: 24px; font-weight: 850; }
.settings { display: grid; gap: 20px; max-width: 820px; }
.settings-block { padding: 28px; border-radius: 16px; background: var(--surface); }
.settings-block h3 { font-size: 18px; font-weight: 800; margin-bottom: 18px; }
.settings-block h4 { font-size: 15px; font-weight: 800; margin: 28px 0 8px; }
.settings-block > p { margin-bottom: 12px; }
.settings-block .form > .btn { justify-self: start; }
.narrow-block { max-width: 620px; }

.thumb-edit { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 28px; align-items: start; }
.thumb-edit form + form { margin-top: 12px; }

.code {
	margin: 0 0 20px;
	padding: 14px 16px;
	overflow-x: auto;
	border-radius: 10px;
	background: var(--code-bg);
	color: var(--code-ink);
	line-height: 1.6;
}

.code code { font-size: 14px; }
:not(pre) > code { padding: 1px 5px; border-radius: 5px; background: var(--hover); }

.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { padding: 8px 12px 8px 0; color: var(--muted); font-size: 13px; font-weight: 700; text-align: left; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); }
.table .tag { margin-left: 6px; }
.cell-action { text-align: right; }
.cell-action form { margin: 0; }

.token-once { margin-bottom: 24px; padding: 20px; border-radius: 14px; background: var(--ok-bg); color: var(--ok-ink); }
.token-once p { margin-bottom: 12px; }
.token-once .code { margin: 0; user-select: all; }

.inline-form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; margin-bottom: 28px; }
.inline-form .field { flex: 1 1 260px; max-width: 420px; }
.inline-form .btn { margin-top: 28px; height: 44px; }

/* Download */

.download .lede { margin-bottom: 24px; }
.download-size { margin-top: 8px; text-align: center; }
.steps { display: grid; gap: 10px; margin: 28px 0 0; padding-left: 22px; }
.steps li { padding-left: 4px; }
.footer a { color: var(--ink); font-weight: 650; }

/* Narrow screens */

@media (max-width: 860px) {
	.game { grid-template-columns: minmax(0, 1fr); gap: 24px; }
	.game-title { font-size: 30px; }
}

@media (max-width: 760px) {
	.bar {
		grid-template-columns: auto minmax(0, 1fr) auto;
		height: auto;
		gap: 10px 12px;
		padding: 10px 16px 12px;
	}

	.logo-name { font-size: 20px; }
	.bar-nav { justify-self: start; }
	.bar-search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
	.bar-account { grid-column: -2; grid-row: 1; justify-self: end; }
	.menu-name { display: none; }
	.main { padding: 24px 16px 48px; }
	.footer { padding: 20px 16px; }
	.grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px 12px; }
	.panel { padding: 28px 20px 24px; }
	.settings-block { padding: 20px; }
	.thumb-edit { grid-template-columns: minmax(0, 1fr); }
	.thumb-preview { max-width: 168px; }
	.profile { gap: 16px; }
	.avatar-lg { width: 80px; height: 80px; font-size: 34px; }
}

@media (max-width: 520px) {
	/* The logo leads to Discover, and Create is in the account menu. */
	.bar-nav { display: none; }
}

@media (max-width: 350px) {
	.bar-nav a { padding: 8px; }
	.logo-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.card .thumb { transition: none; }
}
