/* Excitebike Clone — Ghost Racing */

.ebk-root {
	position: relative;
	width: 100%;
	max-width: 900px;
	margin: 0 auto;
	aspect-ratio: 16 / 9;
	background: #0d0d12;
	border-radius: 6px;
	overflow: hidden;
	outline: none;
	font-family: "Courier New", ui-monospace, monospace;
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;
}

.ebk-root canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;   /* letterbox instead of stretching in fullscreen */
	image-rendering: pixelated;
	display: block;
}

/* ---- fullscreen ---- */

.ebk-fsbtn {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 8;
	width: 34px; height: 34px;
	display: flex; align-items: center; justify-content: center;
	background: rgba(10, 10, 16, .55);
	border: 1px solid rgba(242, 234, 216, .35);
	border-radius: 4px;
	color: #f2ead8;
	font-size: 16px;
	cursor: pointer;
}
.ebk-fsbtn:hover { border-color: #ffd23f; color: #ffd23f; }

.ebk-root:fullscreen,
.ebk-root.ebk-fs-fallback {
	max-width: none;
	width: 100%;
	height: 100%;
	aspect-ratio: auto;
	border-radius: 0;
	background: #000;
}
.ebk-root.ebk-fs-fallback {
	position: fixed;
	inset: 0;
	z-index: 99999;
}

/* rotate hint: fullscreen + portrait only */
.ebk-rotate {
	display: none;
	position: absolute;
	inset: 0;
	z-index: 9;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: 10px;
	background: rgba(10, 10, 16, .92);
	color: #ffd23f;
	font-size: 15px;
	letter-spacing: 2px;
	text-transform: uppercase;
	text-align: center;
	padding: 20px;
}
.ebk-rotate .ebk-rotate-icon { font-size: 44px; animation: ebk-rot 1.6s ease-in-out infinite; }
@keyframes ebk-rot {
	0%, 20% { transform: rotate(0deg); }
	60%, 100% { transform: rotate(90deg); }
}
@media (orientation: portrait) {
	.ebk-root:fullscreen .ebk-rotate,
	.ebk-root.ebk-fs-fallback .ebk-rotate { display: flex; }
}

/* ---- overlay screens (menu / finish) ---- */

.ebk-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	background: rgba(10, 10, 16, 0.88);
	color: #f2ead8;
	text-align: center;
	padding: 16px;
	z-index: 5;
}

.ebk-overlay-menu {
	background: linear-gradient(rgba(10, 10, 16, 0.82), rgba(10, 10, 16, 0.55) 40%, rgba(10, 10, 16, 0.82));
}

.ebk-overlay h2 {
	margin: 0;
	font-size: clamp(22px, 4.5vw, 40px);
	letter-spacing: 3px;
	text-transform: uppercase;
	color: #ffd23f;
	text-shadow: 3px 3px 0 #b3541e, 6px 6px 0 rgba(0,0,0,.5);
}

.ebk-overlay p { margin: 0; font-size: 14px; opacity: .85; max-width: 480px; }

.ebk-btn {
	font-family: inherit;
	font-size: 16px;
	letter-spacing: 2px;
	text-transform: uppercase;
	padding: 10px 22px;
	background: #ffd23f;
	color: #1a1208;
	border: 0;
	border-bottom: 4px solid #b3541e;
	border-radius: 4px;
	cursor: pointer;
}
.ebk-btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.ebk-btn.ebk-btn-alt { background: #3a3f4b; color: #f2ead8; border-bottom-color: #14161c; }

.ebk-tracks { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.ebk-track-card {
	background: #1c1f28;
	border: 2px solid #3a3f4b;
	border-radius: 6px;
	padding: 12px 16px;
	cursor: pointer;
	min-width: 170px;
}
.ebk-track-card:hover, .ebk-track-card.sel { border-color: #ffd23f; }
.ebk-track-card b { display: block; font-size: 15px; color: #ffd23f; margin-bottom: 4px; }
.ebk-track-card span { font-size: 12px; opacity: .7; }

.ebk-name-row { display: flex; gap: 8px; align-items: center; }
.ebk-name-row input {
	font-family: inherit;
	font-size: 15px;
	padding: 8px 10px;
	width: 160px;
	background: #1c1f28;
	color: #f2ead8;
	border: 2px solid #3a3f4b;
	border-radius: 4px;
}

.ebk-board { width: min(92%, 380px); font-size: 13px; text-align: left; }
.ebk-board table { width: 100%; border-collapse: collapse; }
.ebk-board td, .ebk-board th { padding: 3px 6px; border-bottom: 1px solid #2a2e38; }
.ebk-board th { color: #ffd23f; text-transform: uppercase; font-size: 11px; letter-spacing: 1px; }
.ebk-board tr.me td { color: #ffd23f; }

.ebk-help { font-size: 12px; opacity: .65; line-height: 1.6; }
.ebk-help kbd {
	background: #2a2e38; border-radius: 3px; padding: 1px 6px;
	border: 1px solid #3a3f4b; font-family: inherit;
}

/* ---- touch controls ---- */

.ebk-touch { position: absolute; inset: 0; z-index: 3; display: none; pointer-events: none; }
.ebk-root.is-touch .ebk-touch { display: block; }

.ebk-pad {
	position: absolute;
	bottom: calc(10px + env(safe-area-inset-bottom, 0px));
	width: 58px; height: 58px;
	border-radius: 50%;
	background: rgba(242, 234, 216, .12);
	border: 2px solid rgba(242, 234, 216, .35);
	color: #f2ead8;
	font-size: 11px;
	letter-spacing: 1px;
	display: flex; align-items: center; justify-content: center;
	pointer-events: auto;
}
.ebk-pad:active { background: rgba(255, 210, 63, .35); }
.ebk-pad.gas   { right: calc(84px + env(safe-area-inset-right, 0px)); }
.ebk-pad.turbo { right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
.ebk-pad.up    { left: calc(14px + env(safe-area-inset-left, 0px)); bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
.ebk-pad.down  { left: calc(14px + env(safe-area-inset-left, 0px)); }
.ebk-pad.tl    { left: calc(84px + env(safe-area-inset-left, 0px));  }
.ebk-pad.tr    { left: calc(152px + env(safe-area-inset-left, 0px)); }
.ebk-pad.rst   { bottom: auto; top: 48px; right: calc(8px + env(safe-area-inset-right, 0px)); width: 42px; height: 42px; font-size: 18px; }
