/* ═══════════════════════════════════════════════════════════════════════════
   CRASH RUN - COMMAND CENTER EDITION
   Matching 3AmSheep Welcome Page & Dashboard Aesthetic
═══════════════════════════════════════════════════════════════════════════ */

/* Fix header width issue - ensure full width layout */
.wrapper,
header,
.navbar,
#page-body {
	width: 100% !important;
	max-width: 100% !important;
}

/* Remove any horizontal overflow issues */
html,
body {
	overflow-x: hidden;
}

:root {
	--crash-bg: radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.10), transparent 28%),
		radial-gradient(circle at 85% 0%, rgba(124, 58, 237, 0.12), transparent 32%),
		#0b1220;
	--crash-card: rgba(15, 23, 42, 0.95);
	--crash-panel: rgba(17, 25, 45, 0.85);
	--crash-border: rgba(255, 255, 255, 0.08);
	--crash-text: rgba(248, 250, 252, 0.95);
	--crash-muted: rgba(148, 163, 184, 0.9);
	--crash-primary: #38bdf8;
	--crash-secondary: #a855f7;
	--crash-accent: #22c55e;
	--crash-warning: #f59e0b;
	--crash-danger: #ef4444;
	--crash-glow-cyan: rgba(56, 189, 248, 0.35);
	--crash-glow-purple: rgba(168, 85, 247, 0.35);
	--crash-glow-green: rgba(34, 197, 94, 0.35);
	--shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

/* Scope body styles to crash game only, don't override global body */
#page-body {
	background: var(--crash-bg);
}

.crash-app {
	max-width: 1100px;
	margin: 0 auto;
	padding: clamp(1.5rem, 4vw, 4rem) clamp(1rem, 3vw, 3rem) 5rem;
	display: flex;
	flex-direction: column;
	gap: clamp(1.5rem, 3vw, 2.5rem);
	color: var(--crash-text);
	font-family: "Segoe UI", "Inter", system-ui, sans-serif;
}

.crash-card {
	background: var(--crash-panel);
	border-radius: 20px;
	padding: clamp(1.5rem, 3vw, 2.5rem);
	border: 1px solid var(--crash-border);
	box-shadow: var(--shadow);
	position: relative;
	backdrop-filter: blur(10px);
}

.crash-header {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	background:
		radial-gradient(ellipse at 20% 0%, rgba(56, 189, 248, 0.15), transparent 50%),
		radial-gradient(ellipse at 80% 100%, rgba(168, 85, 247, 0.12), transparent 50%),
		var(--crash-card);
	border-radius: 24px;
	position: relative;
	overflow: hidden;
}

.crash-header::before {
	content: '';
	position: absolute;
	top: -50%;
	left: -50%;
	width: 200%;
	height: 200%;
	background: radial-gradient(circle at center, var(--crash-glow-cyan), transparent 60%);
	opacity: 0.2;
	pointer-events: none;
}

.crash-title {
	position: relative;
	z-index: 1;
}

.crash-title .meter-label {
	background: rgba(168, 85, 247, 0.12);
	border: 1px solid rgba(168, 85, 247, 0.3);
	border-radius: 20px;
	color: #c4b5fd;
	padding: 4px 12px;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.15em;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 12px;
}

.crash-title .meter-label::before {
	content: '🚀';
	font-size: 0.9rem;
}

.crash-title h1 {
	margin: 0;
	font-size: clamp(2.5rem, 4vw, 3.5rem);
	font-weight: 800;
	background: linear-gradient(135deg, var(--crash-primary), var(--crash-secondary));
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	line-height: 1.2;
}

.meter-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 1rem;
	position: relative;
	z-index: 1;
}

.meter {
	background: rgba(255, 255, 255, 0.02);
	border-radius: 14px;
	padding: 16px 20px;
	text-align: center;
	border: 1px solid var(--crash-border);
	position: relative;
	overflow: hidden;
	transition: all 0.3s ease;
}

.meter::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--crash-primary), var(--crash-secondary));
}

.meter:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
	border-color: rgba(56, 189, 248, 0.3);
}

.meter-label {
	display: block;
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--crash-muted);
	margin-bottom: 6px;
	font-weight: 600;
}

.meter-value {
	font-size: 1.6rem;
	font-weight: 800;
	color: #fff;
}

#crash-balance {
	color: var(--crash-primary);
}

.crash-stage {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.graph-wrapper {
	height: 360px;
	background: linear-gradient(135deg, rgba(4, 7, 17, 0.95), rgba(11, 21, 38, 0.98));
	border-radius: 16px;
	border: 1px solid var(--crash-border);
	position: relative;
	overflow: hidden;
	box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.7);
}

.graph-canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 1;
}

.graph-line {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 6px;
	height: 6px;
	background: var(--crash-accent);
	border-radius: 999px;
	box-shadow: 0 0 20px var(--crash-glow-green);
	transition: transform 0.1s linear, left 0.1s linear, bottom 0.1s linear;
	z-index: 2;
}

.graph-rocket {
	position: absolute;
	bottom: 12px;
	left: 0;
	font-size: 1.8rem;
	filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.7));
	transform: translate(0, 0);
	transition: transform 0.1s linear, left 0.1s linear, bottom 0.1s linear;
	z-index: 3;
}

.graph-rocket.pulse {
	animation: rocketPulse 1.5s ease-in-out infinite alternate;
}

.graph-rocket.crashed {
	animation: none;
	filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.7));
}

.graph-rocket.hidden {
	opacity: 0;
}

.graph-crash {
	position: absolute;
	color: var(--crash-danger);
	font-weight: 800;
	font-size: 1.6rem;
	display: none;
	top: 20px;
	right: 20px;
	text-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

@keyframes rocketPulse {
	from {
		transform: translate(0, 0) scale(1);
	}

	to {
		transform: translate(0, -4px) scale(1.05);
	}
}

.status-banner {
	text-align: center;
	font-size: 1.05rem;
	color: var(--crash-muted);
	min-height: 1.5rem;
	font-weight: 600;
}

.control-panel {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 1rem;
}

.control-block {
	background: rgba(255, 255, 255, 0.02);
	padding: 16px 20px;
	border-radius: 14px;
	border: 1px solid var(--crash-border);
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	position: relative;
	overflow: hidden;
}

.control-block::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 2px;
	background: linear-gradient(90deg, var(--crash-primary), var(--crash-secondary));
	opacity: 0.5;
}

.control-block label {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--crash-muted);
	font-weight: 600;
}

.control-block input[type="number"],
.control-block input[type="text"] {
	width: 100%;
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid var(--crash-border);
	background: rgba(0, 0, 0, 0.3);
	color: var(--crash-text);
	font-size: 1rem;
	transition: all 0.2s ease;
	font-weight: 600;
}

.control-block input:focus {
	outline: none;
	border-color: rgba(56, 189, 248, 0.4);
	background: rgba(0, 0, 0, 0.4);
}

.control-help {
	font-size: 0.75rem;
	color: var(--crash-muted);
	opacity: 0.8;
}

.control-actions {
	display: flex;
	gap: 1rem;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
}

.crash-button {
	flex: 1;
	min-width: 160px;
	padding: 14px 28px;
	border-radius: 14px;
	border: none;
	font-size: 1rem;
	text-transform: uppercase;
	letter-spacing: 0.15em;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.25s ease;
}

.crash-button.primary {
	background: linear-gradient(135deg, var(--crash-primary), var(--crash-secondary));
	color: #fff;
	box-shadow: 0 8px 24px var(--crash-glow-cyan);
}

.crash-button.primary:hover:not(:disabled) {
	transform: translateY(-2px);
	box-shadow: 0 12px 32px var(--crash-glow-cyan);
}

.crash-button.secondary {
	background: rgba(255, 255, 255, 0.06);
	color: var(--crash-text);
	border: 1px solid var(--crash-border);
}

.crash-button.secondary:hover:not(:disabled) {
	background: rgba(255, 255, 255, 0.1);
	border-color: rgba(56, 189, 248, 0.3);
	box-shadow: 0 4px 12px rgba(56, 189, 248, 0.15);
}

.crash-button:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.crash-button:active:not(:disabled) {
	transform: translateY(0);
}

.crash-actions-card {
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 1.5rem;
}

.results-log {
	display: grid;
	gap: 0.5rem;
	font-family: "Roboto Mono", monospace;
	background: rgba(0, 0, 0, 0.3);
	border-radius: 12px;
	padding: 1rem;
	border: 1px solid var(--crash-border);
	max-height: 300px;
	overflow: auto;
	scrollbar-width: thin;
	scrollbar-color: rgba(56, 189, 248, 0.3) transparent;
}

.results-log::-webkit-scrollbar {
	width: 6px;
}

.results-log::-webkit-scrollbar-track {
	background: transparent;
}

.results-log::-webkit-scrollbar-thumb {
	background: rgba(56, 189, 248, 0.3);
	border-radius: 999px;
}

.results-log::-webkit-scrollbar-thumb:hover {
	background: rgba(56, 189, 248, 0.5);
}

.results-log .entry {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 8px 10px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.02);
	border: 1px solid var(--crash-border);
	transition: all 0.2s ease;
}

.results-log .entry:hover {
	background: rgba(255, 255, 255, 0.05);
	border-color: rgba(56, 189, 248, 0.2);
}

.entry.win {
	color: var(--crash-accent);
	border-color: rgba(34, 197, 94, 0.2);
}

.entry.lose {
	color: var(--crash-danger);
	border-color: rgba(239, 68, 68, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN - COMPREHENSIVE MOBILE SUPPORT
═══════════════════════════════════════════════════════════════════════════ */

/* Tablet and smaller desktops (768px - 1024px) */
@media (max-width: 1024px) {
	.crash-app {
		padding: 2rem 1.5rem 3rem;
		gap: 1.75rem;
	}

	.crash-title h1 {
		font-size: 2.75rem;
	}

	.meter-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.graph-wrapper {
		height: 320px;
	}

	.control-panel {
		grid-template-columns: 1fr;
	}
}

/* Mobile and tablets (≤768px) */
@media (max-width: 768px) {
	.crash-app {
		padding: 1.5rem 1rem 2.5rem;
		gap: 1.5rem;
	}

	.crash-card {
		padding: 1.5rem;
		border-radius: 18px;
	}

	.crash-header {
		gap: 1.25rem;
	}

	.crash-title .meter-label {
		font-size: 0.65rem;
		padding: 4px 10px;
		margin-bottom: 10px;
	}

	.crash-title h1 {
		font-size: 2.25rem;
	}

	.meter-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.85rem;
	}

	.meter {
		padding: 14px 16px;
	}

	.meter-label {
		font-size: 0.65rem;
	}

	.meter-value {
		font-size: 1.4rem;
	}

	.graph-wrapper {
		height: 300px;
	}

	.graph-rocket {
		font-size: 1.5rem;
	}

	.graph-crash {
		font-size: 1.4rem;
		top: 15px;
		right: 15px;
	}

	.status-banner {
		font-size: 0.95rem;
	}

	.control-panel {
		grid-template-columns: 1fr;
		gap: 0.85rem;
	}

	.control-block {
		padding: 14px 16px;
	}

	.control-block label {
		font-size: 0.7rem;
	}

	.control-block input[type="number"],
	.control-block input[type="text"] {
		padding: 9px 11px;
		font-size: 0.95rem;
	}

	.control-help {
		font-size: 0.7rem;
	}

	.control-actions {
		flex-direction: column;
		gap: 0.85rem;
	}

	.crash-button {
		width: 100%;
		min-width: 0;
		padding: 13px 24px;
		font-size: 0.95rem;
	}

	.results-log {
		max-height: 240px;
		padding: 0.85rem;
	}

	.results-log .entry {
		padding: 7px 9px;
		font-size: 0.9rem;
	}
}

/* Small mobile devices (≤480px) */
@media (max-width: 480px) {
	.crash-app {
		padding: 1rem 0.75rem 2rem;
		gap: 1.25rem;
	}

	.crash-card {
		padding: 1.25rem;
		border-radius: 16px;
	}

	.crash-header {
		gap: 1rem;
	}

	.crash-title .meter-label {
		font-size: 0.6rem;
		padding: 3px 8px;
	}

	.crash-title h1 {
		font-size: 1.85rem;
	}

	.meter-grid {
		grid-template-columns: 1fr;
		gap: 0.75rem;
	}

	.meter {
		padding: 12px 14px;
	}

	.meter-value {
		font-size: 1.3rem;
	}

	.graph-wrapper {
		height: 260px;
	}

	.graph-rocket {
		font-size: 1.3rem;
	}

	.graph-crash {
		font-size: 1.2rem;
		top: 12px;
		right: 12px;
	}

	.status-banner {
		font-size: 0.9rem;
	}

	.control-block {
		padding: 12px 14px;
	}

	.control-block input[type="number"],
	.control-block input[type="text"] {
		padding: 8px 10px;
		font-size: 0.9rem;
	}

	.crash-button {
		padding: 12px 20px;
		font-size: 0.9rem;
		letter-spacing: 0.12em;
	}

	.results-log {
		max-height: 200px;
		padding: 0.75rem;
		font-size: 0.85rem;
	}
}

/* Very small devices (≤360px) */
@media (max-width: 360px) {
	.crash-app {
		padding: 0.85rem 0.6rem 1.75rem;
		gap: 1rem;
	}

	.crash-card {
		padding: 1rem;
	}

	.crash-title h1 {
		font-size: 1.6rem;
	}

	.meter {
		padding: 10px 12px;
	}

	.meter-value {
		font-size: 1.2rem;
	}

	.graph-wrapper {
		height: 220px;
	}

	.graph-rocket {
		font-size: 1.1rem;
	}

	.crash-button {
		padding: 11px 18px;
		font-size: 0.85rem;
	}
}

/* Landscape orientation optimizations */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
	.crash-app {
		padding: 1rem 1.5rem 1.5rem;
		gap: 1.25rem;
	}

	.crash-title h1 {
		font-size: 2rem;
	}

	.meter-grid {
		grid-template-columns: repeat(4, 1fr);
	}

	.graph-wrapper {
		height: 240px;
	}

	.control-panel {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.75rem;
	}

	.control-actions {
		flex-direction: row;
		gap: 0.75rem;
	}

	.crash-button {
		min-width: 140px;
	}
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {

	.crash-button,
	.control-block input {
		min-height: 44px;
		/* iOS minimum touch target */
	}

	.crash-button {
		-webkit-tap-highlight-color: rgba(56, 189, 248, 0.3);
	}

	/* Prevent text selection on game UI */
	.crash-stage,
	.meter-grid,
	.control-panel {
		-webkit-user-select: none;
		-moz-user-select: none;
		-ms-user-select: none;
		user-select: none;
	}

	/* Allow text selection in input fields */
	.control-block input {
		-webkit-user-select: text;
		-moz-user-select: text;
		-ms-user-select: text;
		user-select: text;
	}
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
	.graph-canvas {
		image-rendering: -webkit-optimize-contrast;
		image-rendering: crisp-edges;
	}
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}

	.crash-header::before {
		animation: none;
	}

	.graph-rocket {
		animation: none !important;
	}
}

/* Prevent horizontal overflow */
.crash-app,
.crash-card,
.crash-stage,
.control-panel,
.results-log {
	max-width: 100%;
	box-sizing: border-box;
	overflow-x: hidden;
}