/* Local component styles. The shared site header, footer and dimensions stay unchanged. */
@font-face {
	font-family: "Andika Rally";
	src: url("../fonts/Andika-Bold.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}
#word-rally {
	font-size: 16px;
	line-height: 1.4;
}
#word-rally .rally-settings {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: end;
	margin: 0 0 24px;
}
#word-rally label {
	display: block;
	font-size: 16px;
	font-weight: 600;
	flex: 1;
	min-width: 135px;
}
#word-rally select {
	display: block;
	width: 100%;
	min-height: 48px;
	margin-top: 6px;
	padding: 9px 28px 9px 10px;
	background: #fff;
	border: 1px solid #aaa;
	border-radius: var(--radius);
	font: 18px var(--font-body);
	color: var(--gray-dark);
}
#word-rally button.button {
	text-transform: none;
	margin: 0;
	min-height: 48px;
	padding: 10px 16px;
	font: 600 16px var(--font-body);
	letter-spacing: 1px;
	cursor: pointer;
}
#word-rally .rally-actions {
	display: flex;
	gap: 12px;
	align-items: center;
}
#word-rally button:disabled {
	opacity: 0.55;
	cursor: default;
}
#word-rally .rally-stage {
	max-width: 720px;
	margin: auto;
	scroll-margin-top: 8px;
}
#word-rally .rally-hud {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	padding: 12px;
	background: #263e42;
	color: #fff;
	font-size: 16px;
	border-radius: var(--radius) var(--radius) 0 0;
}
#word-rally .rally-hud strong {
	color: #fff;
	font-size: 22px;
	margin-left: 5px;
}
#word-rally #mission {
	color: #e8f1df;
	text-align: center;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.25;
}
#word-rally .rally-canvas-wrap {
	position: relative;
	background: #567f4f;
	overflow: hidden;
	margin-inline: auto;
	max-width: 100%;
	max-height: 100%;
}
#word-rally canvas {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: 1/1;
	touch-action: none;
	outline-offset: -4px;
}
#word-rally .rally-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	background: #102b37a6;
	padding: 24px;
	text-align: center;
}
#word-rally .rally-overlay > div {
	max-width: 360px;
	background: #fff;
	border-radius: var(--radius);
	padding: 24px;
	color: var(--gray-dark);
}
#word-rally .rally-overlay h2 {
	text-transform: none;
	font-size: 24px;
	letter-spacing: 1px;
	margin: 0 0 12px;
}
#word-rally .rally-overlay p {
	font-size: 18px;
	line-height: 1.5;
	margin: 0 0 16px;
}
#word-rally [hidden] {
	display: none !important;
}
#word-rally .rally-controls {
	display: flex;
	gap: 8px;
	align-items: center;
	background: #263e42;
	padding: 10px;
	border-radius: 0 0 var(--radius) var(--radius);
	touch-action: none;
	user-select: none;
}
#word-rally .rally-controls button {
	font: 600 24px var(--font-body);
	width: 50px;
	min-height: 48px;
	border: 1px solid #728a8a;
	background: #fff;
	color: #333;
	border-radius: var(--radius);
	cursor: pointer;
	padding: 4px;
}
#word-rally .rally-controls span {
	color: #fff;
	font-size: 16px;
	line-height: 1.2;
	margin-left: auto;
	text-align: right;
}
#word-rally #message {
	font-size: 16px;
	line-height: 1.5;
	min-height: 48px;
	margin: 12px 0;
}
#word-rally details {
	font-size: 16px;
	margin-top: 20px;
}
#word-rally summary {
	font-weight: 600;
	cursor: pointer;
}
#word-rally details p {
	margin: 12px 0;
}
@media (max-width: 460px) {
	#word-rally .rally-settings {
		gap: 10px;
	}
	#word-rally label {
		min-width: 120px;
	}
	#word-rally .rally-actions {
		flex: 0 0 100%;
		gap: 10px;
	}
	#word-rally .rally-actions > .button {
		flex: 1;
	}
	#word-rally .rally-hud {
		gap: 6px;
		padding: 10px 8px;
	}
	#word-rally .rally-hud strong {
		font-size: 20px;
	}
	#word-rally #mission {
		font-size: 16px;
	}
	#word-rally .rally-controls {
		padding: 8px;
		gap: 5px;
	}
	#word-rally .rally-controls button {
		width: 42px;
		min-height: 46px;
	}
	#word-rally .rally-controls span {
		max-width: 110px;
	}
}

/* Only this game component adapts; the surrounding site retains its dimensions. */
#word-rally,
#word-rally * {
	box-sizing: border-box;
}
#word-rally {
	min-width: 0;
	max-width: 100%;
}
#word-rally .rally-stage {
	width: 100%;
	min-width: 0;
	max-width: 720px;
}
#word-rally .rally-settings > * {
	max-width: 100%;
	min-width: 0;
}
#word-rally .rally-settings label {
	flex-basis: 135px;
}
#word-rally .rally-hud > span {
	min-width: 0;
	overflow-wrap: anywhere;
}
#word-rally .rally-controls button {
	flex: 0 0 44px;
	width: 44px;
	min-width: 44px;
	min-height: 44px;
}
#word-rally .rally-controls span {
	min-width: 0;
	overflow-wrap: anywhere;
}
#word-rally .rally-overlay {
	padding: 12px;
}
#word-rally .rally-overlay > div {
	max-height: 100%;
	overflow: auto;
	padding: 16px;
}
@media (max-width: 980px) {
	#word-rally .rally-stage {
		scroll-margin-top: 56px;
	}
}
@media (max-width: 360px) {
	#word-rally .rally-controls span {
		display: none;
	}
	#word-rally .rally-controls {
		justify-content: space-between;
	}
	#word-rally .rally-hud {
		gap: 4px;
		padding: 8px 6px;
	}
	#word-rally .rally-hud strong {
		font-size: 18px;
		margin-left: 2px;
	}
	#word-rally #mission {
		font-size: 14px;
	}
}
@media (max-height: 480px) {
	#word-rally .rally-hud {
		padding: 6px 8px;
	}
	#word-rally .rally-controls {
		padding: 5px 8px;
	}
	#word-rally .rally-controls span {
		max-width: none;
	}
	#word-rally .rally-overlay h2 {
		font-size: 18px;
		margin-bottom: 4px;
	}
	#word-rally .rally-overlay p {
		font-size: 16px;
		margin-bottom: 6px;
	}
	#word-rally .rally-overlay > div {
		padding: 8px;
	}
}

/* All selections wrap above a dedicated centered action row. */
#word-rally .rally-settings {
	justify-content: center;
}
#word-rally .rally-settings label {
	flex: 1 1 var(--menu-min, 185px);
	min-width: min(100%, var(--menu-min, 185px));
	max-width: 100%;
}
#word-rally .rally-settings select {
	min-width: 0;
	text-overflow: clip;
	white-space: nowrap;
}
#word-rally .rally-actions {
	scroll-margin-top: 8px;
	order: 100;
	flex: 0 0 100%;
	width: 100%;
	justify-content: center;
	flex-wrap: wrap;
	gap: 12px;
	padding-top: 4px;
}
#word-rally .rally-actions > .button {
	flex: 0 1 auto;
	min-width: 110px;
	max-width: 100%;
	white-space: nowrap;
}
@media (max-width: 980px) {
	#word-rally .rally-actions {
		scroll-margin-top: 56px;
	}
}

/* Two deliberate settings rows: vehicle choice always stays with difficulty and mode. */
#word-rally .rally-settings {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 12px;
	justify-content: stretch;
	align-items: stretch;
}
#word-rally .rally-setting-row {
	width: 100%;
	min-width: 0;
	align-items: end;
	gap: 12px;
}
#word-rally .rally-primary-row {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
}
#word-rally .rally-secondary-row {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
}
#word-rally .rally-secondary-row label {
	flex: 0 1 260px;
}
#word-rally .rally-secondary-row:not(:has(label:not([hidden]))) {
	display: none;
}
#word-rally .rally-actions {
	padding-top: 4px;
}
@media (max-width: 680px) {
	#word-rally .rally-primary-row {
		grid-template-columns: minmax(0, 1fr);
	}
	#word-rally .rally-secondary-row {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
	}
	#word-rally .rally-secondary-row label {
		width: 100%;
	}
}

/* Starting and paused cards share the game's existing button style. */
#word-rally .rally-controls {
	justify-content: center;
}
#word-rally #rally-play-overlay {
	display: block;
	margin: 0 auto;
	max-width: 100%;
	white-space: nowrap;
}
#word-rally #overlay > div {
	box-sizing: border-box;
}
