/**
 * WP Racing Game – Styles
 *
 * Alle Regeln sind konsequent auf ".wrg-game-container" gekapselt, damit
 * keine Konflikte mit bestehendem Theme-CSS entstehen und umgekehrt
 * Theme-Styles die Funktionalität des Plugins nicht beeinträchtigen.
 * Es wird keine eigene Schriftart geladen – die Typografie des Themes
 * wird über "font-family: inherit" übernommen.
 */

.wrg-game-container {
	--wrg-primary: #2563eb;
	--wrg-primary-dark: #1d4ed8;
	--wrg-primary-light: #dbeafe;
	--wrg-bg: #f8fafc;
	--wrg-surface: #ffffff;
	--wrg-border: #e2e8f0;
	--wrg-text: #1e293b;
	--wrg-text-muted: #64748b;
	--wrg-success: #16a34a;
	--wrg-radius-lg: 16px;
	--wrg-radius-md: 10px;
	--wrg-shadow: 0 4px 18px rgba(30, 41, 59, 0.08);

	box-sizing: border-box;
	max-width: 480px;
	margin: 0 auto;
	padding: 20px;
	background: var(--wrg-surface);
	border: 1px solid var(--wrg-border);
	border-radius: var(--wrg-radius-lg);
	box-shadow: var(--wrg-shadow);
	color: var(--wrg-text);
	font-family: inherit;
	line-height: 1.5;
	-webkit-tap-highlight-color: transparent;
}

.wrg-game-container *,
.wrg-game-container *::before,
.wrg-game-container *::after {
	box-sizing: border-box;
}

.wrg-game-container button {
	font-family: inherit;
	font-size: inherit;
	color: inherit;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.wrg-game-container p {
	font-family: inherit;
}

/* Kopfbereich */

.wrg-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 14px;
}

.wrg-title {
	margin: 0;
	font-size: 1.25em;
	font-weight: 700;
	color: var(--wrg-text);
}

.wrg-sound-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 1px solid var(--wrg-border);
	background: var(--wrg-bg);
	transition: background-color 0.15s ease, transform 0.12s ease;
}
.wrg-sound-toggle:hover {
	background: var(--wrg-primary-light);
}
.wrg-sound-toggle:active {
	transform: scale(0.94);
}
.wrg-sound-toggle .wrg-sound-icon {
	font-size: 1.15em;
	line-height: 1;
}

/* Schwierigkeitsauswahl */

.wrg-difficulty-select {
	display: flex;
	gap: 8px;
	margin: 0 0 16px;
}

.wrg-diff-btn {
	flex: 1;
	padding: 9px 6px;
	border: 1px solid var(--wrg-border);
	border-radius: var(--wrg-radius-md);
	background: var(--wrg-bg);
	color: var(--wrg-text-muted);
	font-weight: 600;
	font-size: 0.9em;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.wrg-diff-btn:hover {
	border-color: var(--wrg-primary);
	color: var(--wrg-primary);
}
.wrg-diff-btn.wrg-diff-active {
	background: var(--wrg-primary);
	border-color: var(--wrg-primary);
	color: #ffffff;
}
.wrg-diff-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* Statuszeile */

.wrg-stats-bar {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 4px;
	margin: 0 0 16px;
	padding: 12px 8px;
	background: var(--wrg-bg);
	border: 1px solid var(--wrg-border);
	border-radius: var(--wrg-radius-md);
}

.wrg-stat {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	text-align: center;
}
.wrg-stat:not(:last-child)::after {
	content: "";
	position: absolute;
	right: -2px;
	top: 12%;
	bottom: 12%;
	width: 1px;
	background: var(--wrg-border);
}

.wrg-stat-label {
	font-size: 0.72em;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--wrg-text-muted);
	font-weight: 600;
}
.wrg-stat-value {
	font-size: 1.15em;
	font-weight: 700;
	color: var(--wrg-primary-dark);
	font-variant-numeric: tabular-nums;
}

/* Spielfläche */

.wrg-canvas-wrapper {
	position: relative;
	width: 100%;
	aspect-ratio: 400 / 620;
	overflow: hidden;
	border: 1px solid var(--wrg-border);
	border-radius: var(--wrg-radius-md);
	background: #eef2f7;
}

.wrg-canvas {
	display: block;
	width: 100%;
	height: 100%;
	touch-action: none;
}

.wrg-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 24px;
	background: rgba(248, 250, 252, 0.94);
	text-align: center;
	animation: wrg-fade-in 0.2s ease;
}
.wrg-overlay.wrg-is-hidden {
	display: none;
}

.wrg-overlay-text {
	margin: 0;
	font-size: 1.05em;
	color: var(--wrg-text);
}
.wrg-overlay-title {
	margin: 0;
	font-size: 1.35em;
	font-weight: 700;
	color: var(--wrg-primary-dark);
}
.wrg-overlay-highscore-note {
	margin: -6px 0 0;
	font-weight: 700;
	color: var(--wrg-success);
}
.wrg-overlay-highscore-note.wrg-is-hidden {
	display: none;
}

@keyframes wrg-fade-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Buttons */

.wrg-btn {
	padding: 10px 22px;
	border: 1px solid transparent;
	border-radius: var(--wrg-radius-md);
	font-weight: 700;
	font-size: 0.95em;
	transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.wrg-btn:active {
	transform: scale(0.96);
}

.wrg-btn-primary {
	background: var(--wrg-primary);
	color: #ffffff;
	box-shadow: 0 2px 8px rgba(37, 99, 235, 0.32);
}
.wrg-btn-primary:hover {
	background: var(--wrg-primary-dark);
}

.wrg-btn-secondary {
	background: var(--wrg-surface);
	color: var(--wrg-primary-dark);
	border-color: var(--wrg-border);
}
.wrg-btn-secondary:hover {
	border-color: var(--wrg-primary);
}
.wrg-btn-secondary:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Touch-Steuerung */

.wrg-touch-controls {
	position: absolute;
	bottom: 14px;
	left: 0;
	right: 0;
	display: flex;
	justify-content: space-between;
	padding: 0 14px;
	pointer-events: none;
}
.wrg-touch-btn {
	pointer-events: auto;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	border: 1px solid var(--wrg-border);
	background: rgba(255, 255, 255, 0.88);
	color: var(--wrg-primary-dark);
	font-size: 1.5em;
	font-weight: 700;
	box-shadow: 0 2px 8px rgba(30, 41, 59, 0.12);
}
.wrg-touch-btn:active {
	background: var(--wrg-primary-light);
	transform: scale(0.94);
}

@media (min-width: 641px) {
	.wrg-touch-controls {
		display: none;
	}
}

/* Steuerleiste unterhalb der Spielfläche */

.wrg-controls-bar {
	display: flex;
	gap: 10px;
	margin: 16px 0 0;
}
.wrg-controls-bar .wrg-btn {
	flex: 1;
}

.wrg-hint {
	margin: 12px 0 0;
	font-size: 0.8em;
	color: var(--wrg-text-muted);
	text-align: center;
}

/* Responsive Anpassungen */

@media (max-width: 480px) {
	.wrg-game-container {
		padding: 14px;
		border-radius: var(--wrg-radius-md);
	}
	.wrg-title {
		font-size: 1.1em;
	}
	.wrg-stat-value {
		font-size: 1em;
	}
	.wrg-btn {
		padding: 9px 14px;
		font-size: 0.9em;
	}
	.wrg-hint {
		font-size: 0.75em;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wrg-game-container * {
		animation-duration: 0.001ms !important;
		transition-duration: 0.001ms !important;
	}
}
