/*=== Base =====================================================================
The bones every game is built on: the page, the screens, the cards, the keys with a hard offset shadow that press
flat under a tap, the lobby (the code, the seats, the roles) and the home screen's hero. Written on semantic tokens
a game's own stylesheet sets from its palette, after this one: what is a background, a plate, a key, a border, the
text, the accent. The defaults below are SymbolSync's, the series' type: its palette's colors by the names its
palette.css gives them (ink, steel, sage, paper, tan), so a page whose palette is named as SymbolSync's needs no
mapping of its own, as the template's. Every game maps its own palette onto these, and one that wants rounded corners,
a softer press or a different entrance sets --radius, --snap and --screen-in, and one with a second face for its
title, keys and headings sets --display-font (and --display-weight, for a face with no bold); anything it wants otherwise it overrides
by the same selector in its own stylesheet, which loads after this one. Mobile first: a phone in portrait is the
layout everything else grows from */

:root {
	--font: "IBM Plex Mono", "Courier New", Courier, monospace;
	--display-font: var(--font); /* The title, the keys, the lobby's headings: a game's second face, if it has one */
	--display-weight: 700; /* Their weight */
	--bg: var(--ink); /* The page */
	--plate: var(--ink-2); /* A card */
	--field: var(--ink); /* The code block and the code field */
	--key: var(--ink-3); /* A key */
	--border: var(--steel); /* Borders */
	--key-border: var(--border); /* A key's and a field's border, where a game lightens it */
	--text: var(--paper);
	--muted: var(--sage); /* Secondary text */
	--accent: var(--tan); /* The primary key, the code, a selected key, what's lit */
	--accent-text: var(--bg); /* Text on the accent */
	--primary-border: var(--accent); /* The primary key's border */
	--select: var(--accent); /* A selected key's border and text, and a field's focus */
	--select-wash: color-mix(in srgb, var(--accent) 14%, transparent); /* A selected key's background */
	--select-text: var(--accent);
	--focus: var(--accent); /* The keyboard focus ring */
	--shadow-color: var(--border);
	--shadow: 4px 4px 0 var(--shadow-color);
	--shadow-small: 3px 3px 0 var(--shadow-color);
	--radius: 0;
	--snap: 60ms; /* A press, and anything else that changes state */
	--disabled: 0.35; /* A disabled key's opacity */
	--screen-in: screen_in 90ms steps(3) both; /* A screen's entrance */
	--safe-top: env(safe-area-inset-top, 0px);
	--safe-right: env(safe-area-inset-right, 0px);
	--safe-bottom: env(safe-area-inset-bottom, 0px);
	--safe-left: env(safe-area-inset-left, 0px);
}

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

html {
	background: var(--bg);
	color: var(--text);
	font: 15px/1.5 var(--font);
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	min-height: 100dvh;
	overflow-x: hidden;
}

button {
	font: inherit;
	color: inherit;
}

.hidden {
	display: none !important;
}


/*=== The page =================================================================*/

#app {
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	max-width: 560px;
	margin: 0 auto;
	padding: calc(20px + var(--safe-top)) calc(16px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(16px + var(--safe-left));
}

.screen {
	display: flex;
	flex-direction: column;
	flex: 1;
	animation: var(--screen-in);
}

.card {
	background: var(--plate);
	border: 2px solid var(--border);
	border-radius: var(--radius);
	padding: 20px;
	box-shadow: var(--shadow);
}

.menu {
	display: flex;
	flex-direction: column;
	gap: 12px;
}


/*=== Keys =====================================================================*/

.button {
	display: block;
	width: 100%;
	text-align: left;
	padding: 12px 16px;
	border: 2px solid var(--key-border);
	border-radius: var(--radius);
	background: var(--key);
	color: var(--text);
	font-family: var(--display-font);
	font-weight: var(--display-weight);
	letter-spacing: 1px;
	text-transform: uppercase;
	line-height: 1.2;
	cursor: pointer;
	box-shadow: var(--shadow-small);
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	transition: transform var(--snap), box-shadow var(--snap), border-color var(--snap), background-color var(--snap);
}

.button .label {
	display: block;
}

.button .sub {
	display: block;
	margin-top: 3px;
	font-size: 11px;
	font-weight: 400;
	letter-spacing: 1px;
	opacity: 0.8;
}

/* A press sinks the key flat, by the shadow's offset */
.button:active:not(:disabled) {
	transform: translate(3px, 3px);
	box-shadow: none;
}

.button:disabled {
	opacity: var(--disabled);
	box-shadow: none;
	cursor: default;
}

.button.primary {
	background: var(--accent);
	color: var(--accent-text);
	border-color: var(--primary-border);
}

.button.quiet {
	background: transparent;
	box-shadow: none;
}

.button.selected {
	border-color: var(--select);
	background: var(--select-wash);
	color: var(--select-text);
}

.button.primary.selected {
	background: var(--accent);
	color: var(--accent-text);
}

.button.small {
	width: auto;
	padding: 8px 12px;
	font-size: 12px;
}

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


/*=== Home =====================================================================*/

.hero {
	text-align: center;
	padding: 32px 0 24px;
}

.title {
	margin: 0;
	font-family: var(--display-font);
	font-size: 40px;
	font-weight: var(--display-weight);
	line-height: 1;
	letter-spacing: -1px;
}

.title_accent {
	color: var(--accent);
}

.how {
	margin: 0 0 18px;
	color: var(--muted);
	font-size: 14px;
}


/*=== The lobby ================================================================*/

.card.lobby {
	margin: auto 0;
}

.lobby_title {
	margin: 0 0 12px;
	font-family: var(--display-font);
	font-size: 14px;
	font-weight: var(--display-weight);
	letter-spacing: 2px;
	text-transform: uppercase;
	color: var(--muted);
}

.code_block {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border: 2px solid var(--border);
	border-radius: var(--radius);
	background: var(--field);
}

.code_label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: var(--muted);
}

.code {
	flex: 1;
	font-size: 34px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 6px;
	color: var(--accent);
}

.join_block {
	display: flex;
	gap: 10px;
}

.code_input {
	flex: 1;
	min-width: 0;
	padding: 8px 12px;
	border: 2px solid var(--key-border);
	border-radius: var(--radius);
	background: var(--field);
	color: var(--text);
	font: 700 28px/1 var(--font);
	letter-spacing: 6px;
	text-transform: uppercase;
}

.code_input:focus {
	outline: none;
	border-color: var(--select);
}

.lobby_status {
	min-height: 1.5em;
	margin: 12px 0;
	font-size: 13px;
	color: var(--muted);
}

.lobby_status.error {
	color: var(--text);
}

.seats {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin: 0 0 14px;
}

.seat {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 10px 12px;
	border: 2px solid var(--border);
	border-radius: var(--radius);
}

.seat.empty {
	border-style: dashed;
	opacity: 0.6;
}

.seat.away {
	opacity: 0.5;
}

.seat_label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: var(--muted);
}

.seat_role {
	font-size: 15px;
	font-weight: 700;
}

.seat_ready {
	min-height: 1.4em;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--accent);
}

.roles {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin: 0 0 14px;
}


/*=== Motion ===================================================================*/

@keyframes screen_in {
	from { opacity: 0; }
	to { opacity: 1; }
}

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