/* Crawlable How to Play + FAQ + links: real HTML sits below the lobby screen
   (not display:none). HOW TO PLAY brings it on-screen as a scrollable panel. */

/* HOW TO PLAY, SIGN OUT, and EDIT PROFILE share identical hud-btn-wide metrics
   (!important so intro.css / .ssb-edit-profile-btn cannot shrink them). */
#game-ui #howToPlayBtn,
#game-ui #howToPlayBtnSigned,
#game-ui #ssbPlayBtn,
#game-ui #ssbSignOutBtn,
#game-ui #ssbEditProfileBtn {
	box-sizing: border-box !important;
	width: clamp(300px, 20vw, 460px) !important;
	min-width: clamp(300px, 20vw, 460px) !important;
	max-width: 80vw !important;
	height: auto !important;
	min-height: clamp(66px, 4.4vw, 96px) !important;
	padding: 8px 18px !important;
	margin: 0 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	text-align: center !important;
	white-space: normal !important;
	overflow: visible !important;
	text-overflow: clip !important;
	line-height: 1.25 !important;
	font-family: 'Rajdhani', 'Orbitron', sans-serif !important;
	font-size: clamp(1rem, 1.05vw, 1.5rem) !important;
	font-weight: 700 !important;
	letter-spacing: 1px !important;
	text-transform: uppercase !important;
	pointer-events: auto !important;
}
#game-ui #ssbEditProfileBtn { display: none !important; }
#game-ui.ssb-member #ssbEditProfileBtn { display: flex !important; }

/* Signed-out lobby: one PLAY button; Google / Guest live in the Ready-to-Play gate. */
#game-ui #googleBtnWrap,
#game-ui #googleBtn,
#game-ui #guestBtn { display: none !important; }
#game-ui .center-panel.ssb-chosen #ssbPlayBtn { display: none !important; }

/* Signed-in: HOW TO PLAY sits under START (hidden until .ssb-chosen). */
#game-ui #howToPlayBtnSigned { display: none; }
#game-ui .center-panel.ssb-chosen #howToPlayBtnSigned { display: flex; }
/* Don't show the signed-in button until START itself is revealed. */
#game-ui #startBtn.ssb-start-hidden + #howToPlayBtnSigned { display: none !important; }

/* Let Google / Guest / How to Play wrap on narrower desktops instead of overflowing. */
@media (min-width: 701px) {
	#game-ui .center-panel:not(.ssb-chosen) .center-buttons {
		flex-wrap: wrap !important;
	}
}

/* Desktop lobby: no bottom link bar over the 3D scene. */
@media (min-width: 701px) {
	#game-ui:not(.mobile) .bottom-bar { display: none !important; }
}

/* Mobile: hide the mid-screen center panel entirely (old Sign Out lived there).
   HOW TO PLAY + SIGN OUT (when signed in) live in the fixed bottom stack.
   PLAY stays desktop-only — mobile version is coming soon. */
#game-ui.mobile #centerPanel,
#game-ui.mobile #howToPlayBtn,
#game-ui.mobile #howToPlayBtnSigned,
#game-ui.mobile #ssbSignOutBtn,
#game-ui.mobile #ssbEditProfileBtn,
#game-ui.mobile #signedInRow { display: none !important; visibility: hidden !important; }
#game-ui.mobile #howToPlayBtnMobile,
#game-ui.mobile #ssbSignOutBtnMobile,
#game-ui.mobile #ssbEditProfileBtnMobile {
	display: flex !important;
	flex: none !important;
	width: 86vw !important;
	min-width: 86vw !important;
	max-width: 86vw !important;
	height: auto !important;
	min-height: 52px !important;
	font-size: 16px !important;
	font-family: 'Rajdhani', 'Orbitron', sans-serif !important;
	font-weight: 700 !important;
	letter-spacing: 1px !important;
	padding: 10px 14px !important;
	margin: 0 !important;
	overflow: visible !important;
	touch-action: manipulation;
	box-sizing: border-box !important;
	line-height: 1.25 !important;
	text-transform: uppercase !important;
}
/* Reserve the SIGN OUT row in both states so note / pill / HOW TO PLAY
   stay at the same Y. The row is only visible and clickable when signed in. */
#game-ui.mobile #ssbSignOutBtnMobile {
	visibility: hidden !important;
	pointer-events: none !important;
}
#game-ui.mobile.ssb-signed-in #ssbSignOutBtnMobile,
#game-ui.mobile .center-panel.ssb-chosen ~ .bottom-bar #ssbSignOutBtnMobile {
	visibility: visible !important;
	pointer-events: auto !important;
}
#game-ui.mobile #ssbEditProfileBtnMobile { display: none !important; }
#game-ui.mobile.ssb-member #ssbEditProfileBtnMobile {
	display: flex !important;
	visibility: visible !important;
	pointer-events: auto !important;
}
/* Mobile version coming soon: no PLAY (or the Ready-to-Play widget) on phones. */
#game-ui.mobile #ssbPlayBtn,
#game-ui.mobile #ssbPlayBtnMobile { display: none !important; }
#game-ui.mobile #ssbMobileUpdatesCTA,
#game-ui.mobile #ssbMobileUpdatesCTA[hidden] { display: none !important; }
#game-ui:not(.mobile) #howToPlayBtnMobile,
#game-ui:not(.mobile) #ssbPlayBtnMobile,
#game-ui:not(.mobile) #ssbSignOutBtnMobile,
#game-ui:not(.mobile) #ssbEditProfileBtnMobile { display: none !important; }

/* CrazyGames: no external-link panel (portal policy). */
#game-ui.crazygames #howToPlayBtn,
#game-ui.crazygames #howToPlayBtnSigned,
#game-ui.crazygames #howToPlayBtnMobile,
#game-ui.crazygames #ssbPlayBtnMobile,
#game-ui.crazygames #ssbSignOutBtnMobile,
#game-ui.crazygames #ssbEditProfileBtnMobile,
#game-ui.crazygames .bottom-bar { display: none !important; }

/* ---- Info section: below the viewport until opened. Never display:none. ---- */
#ssbInfo {
	position: absolute;
	top: 100%;
	left: 0;
	width: 100%;
	box-sizing: border-box;
	z-index: 0;
	margin: 0;
	padding: 28px 18px 48px;
	background: #070b12;
	color: #e6eef3;
	font-family: 'Rajdhani', 'Segoe UI', Arial, sans-serif;
	font-size: 17px;
	line-height: 1.6;
	text-align: left;
	-webkit-user-select: text;
	-moz-user-select: text;
	-ms-user-select: text;
	user-select: text;
	pointer-events: auto;
}
#ssbInfo .ssb-info-inner {
	max-width: 860px !important;
	width: 100%;
	margin: 0 auto;
	box-sizing: border-box;
	position: relative;
}
#ssbInfo h2 {
	font-family: 'Orbitron', sans-serif;
	font-size: 1.35rem;
	letter-spacing: 1px;
	color: #7ec8ff;
	text-shadow: 0 2px 8px #000;
	margin: 1.4em 0 0.55em;
	padding-bottom: 6px;
	border-bottom: 1px solid rgba(42, 90, 138, 0.7);
}
#ssbInfo h2:first-of-type { margin-top: 0; }
#ssbInfo h3 {
	font-family: 'Rajdhani', 'Orbitron', sans-serif;
	font-size: 1.12rem;
	letter-spacing: 0.5px;
	color: #cfefff;
	margin: 1.15em 0 0.35em;
}
#ssbInfo p, #ssbInfo li { margin: 0 0 0.7em; color: #d5dee8; }
#ssbInfo ul, #ssbInfo ol { padding-left: 1.25em; margin: 0 0 0.8em; }
#ssbInfo b, #ssbInfo strong { color: #fff; }
#ssbInfo a { color: #7ec8ff; }
#ssbInfo table { border-collapse: collapse; width: 100%; margin: 0 0 1em; }
#ssbInfo th, #ssbInfo td {
	border: 1px solid #23394a;
	padding: 8px 10px;
	text-align: left;
}
#ssbInfo th { color: #7ec8ff; background: rgba(13, 21, 32, 0.8); }

#ssbInfo .ssb-info-close,
#ssbInfo .ssb-info-done {
	font-family: 'Orbitron', 'Rajdhani', sans-serif;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
	cursor: pointer;
	color: #1a1200;
	background: linear-gradient(180deg, #ffe566 0%, #ffb800 40%, #e69500 100%);
	border: none;
	border-radius: 10px;
	box-shadow: 0 0 16px rgba(255, 200, 0, 0.45), inset 0 1px 0 #fff8;
}
#ssbInfo .ssb-info-close {
	position: sticky;
	top: 0;
	float: right;
	z-index: 2;
	margin: 0 0 10px 12px;
	padding: 9px 14px;
	font-size: 0.85rem;
	width: auto !important;
	min-width: 0 !important;
	max-width: none !important;
}
#ssbInfo .ssb-info-done {
	display: block;
	margin: 28px auto 8px;
	min-width: 200px;
	padding: 14px 28px;
	font-size: 1.05rem;
}
#ssbInfo .ssb-info-close:hover,
#ssbInfo .ssb-info-done:hover { filter: brightness(1.08); }
#ssbInfo .ssb-info-close:active,
#ssbInfo .ssb-info-done:active { transform: translateY(2px) scale(0.98); }
#ssbInfo button:focus-visible,
#ssbInfo a:focus-visible { outline: 3px solid #7ec8ff; outline-offset: 3px; }

#ssbInfo .ssb-info-links {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	margin: 22px 0 8px;
}
#ssbInfo .ssb-info-links a,
#ssbInfo .ssb-info-links button {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: min(86vw, 420px) !important;
	min-width: min(86vw, 420px) !important;
	max-width: min(86vw, 420px) !important;
	height: auto !important;
	min-height: 48px !important;
	padding: 10px 16px !important;
	margin: 0 !important;
	font-family: 'Rajdhani', 'Orbitron', sans-serif !important;
	font-size: 16px !important;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
	text-decoration: none;
	text-align: center;
	color: #7ec8ff;
	background: linear-gradient(180deg, #1a2a3a 0%, #0d1520 100%);
	border: 1px solid #2a5a8a;
	border-radius: 6px;
	box-shadow: 0 2px 6px rgba(0,0,0,0.5);
	cursor: pointer;
	transform: none;
	zoom: normal;
}
#ssbInfo .ssb-info-links a:hover,
#ssbInfo .ssb-info-links button:hover {
	background: linear-gradient(180deg, #2a4a6a 0%, #1a2a40 100%);
	border-color: #4ac8ff;
	color: #fff;
}

/* Open state: cover the lobby so the 3D canvas/overlays cannot block it. */
body.ssb-info-open #ssbInfo {
	position: fixed;
	inset: 0;
	top: 0;
	z-index: 20000;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	touch-action: pan-y;
	padding: calc(14px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
	background:
		radial-gradient(circle at 50% 0%, rgba(74, 200, 255, 0.16), transparent 55%),
		linear-gradient(165deg, #101820, #070b12 62%);
	border: 2px solid #2a5a8a;
	scrollbar-width: thin;
	scrollbar-color: #2a5a8a #070b12;
}
body.ssb-info-open #ssbInfo::-webkit-scrollbar { width: 10px; }
body.ssb-info-open #ssbInfo::-webkit-scrollbar-thumb { background: #2a5a8a; border-radius: 6px; }

/* Keep the panel usable even while lobby chrome is visibility-hidden during LOADING.
   The section itself is never a #game-ui descendant. */
body.ssb-lobby-loading.ssb-info-open #ssbInfo,
body.ssb-lobby-loading.ssb-info-open #ssbInfo * {
	visibility: visible;
	pointer-events: auto;
}


/* Intro CSS sets p{height:100%} and, under 800px, table{position:fixed} and
   div,button{min-width:95%;font-size:5vw}. Reset those only inside #ssbInfo. */
#ssbInfo p, #ssbInfo label, #ssbInfo li, #ssbInfo h2, #ssbInfo h3,
#ssbInfo td, #ssbInfo th, #ssbInfo div:not(.ssb-info-inner), #ssbInfo nav {
	height: auto !important;
	min-width: 0 !important;
	max-width: none !important;
	position: static !important;
	float: none;
}
#ssbInfo .ssb-info-inner {
	height: auto !important;
	min-width: 0 !important;
	max-width: 860px !important;
	position: relative !important;
	float: none !important;
}
#ssbInfo table, #ssbInfo thead, #ssbInfo tbody, #ssbInfo tr {
	position: static !important;
	left: auto !important;
	top: auto !important;
	display: table;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	height: auto !important;
	transform: none !important;
	zoom: normal;
}
#ssbInfo thead, #ssbInfo tbody { display: table-header-group; }
#ssbInfo tbody { display: table-row-group; }
#ssbInfo tr { display: table-row; }
#ssbInfo th, #ssbInfo td { display: table-cell; }

/* Lobby players-online counter is removed; hide if a cached page still has it. */
#ssbLobbyPlayers, #ssbLobbyPlayersDot, #ssbLobbyPlayersNum { display: none !important; }

/* Mobile: pin the whole lobby stack to the bottom (safe-area aware).
   Order: notice, sign-in CTA, HOW TO PLAY, SIGN OUT. Title stays in .top-bar. */
#game-ui.mobile .bottom-bar,
#game-ui.mobile #ssbMobileBottomStack {
	position: fixed !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	top: auto !important;
	flex: none !important;
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	justify-content: flex-end !important;
	gap: 10px !important;
	width: 100% !important;
	min-height: 0 !important;
	margin: 0 !important;
	overflow: visible !important;
	background: none !important;
	-webkit-mask-image: none !important;
	mask-image: none !important;
	padding: 12px 0 calc(16px + env(safe-area-inset-bottom, 0px)) !important;
	z-index: 1002 !important;
	pointer-events: auto !important;
}
#game-ui.mobile .ssb-mobile-notice,
#game-ui.mobile:not(.crazygames) #ssbMobileUpdatesCTA {
	width: 86vw !important;
	max-width: 420px !important;
	margin: 0 auto !important;
	flex: none !important;
}
#game-ui.mobile .bottom-buttons {
	display: flex !important;
	flex-direction: column !important;
	margin: 0 auto !important;
	width: 100% !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 10px !important;
	flex: none !important;
}
body.ssb-info-open #game-ui .bottom-bar { display: none !important; }

/* Mobile #ssbInfo: readable full-width scroll panel. Desktop rules above stay as-is. */
@media (max-width: 800px) {
	#ssbInfo {
		font-size: 16px !important;
		line-height: 1.6 !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
		transform: none !important;
		zoom: normal !important;
		-webkit-text-size-adjust: 100%;
		text-size-adjust: 100%;
	}
	body.ssb-info-open #ssbInfo {
		position: fixed !important;
		inset: 0 !important;
		width: 100% !important;
		height: auto !important;
		overflow-y: auto !important;
		transform: none !important;
		zoom: normal !important;
		padding: calc(12px + env(safe-area-inset-top, 0px)) calc(14px + env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) calc(14px + env(safe-area-inset-left, 0px)) !important;
	}
	#ssbInfo .ssb-info-inner {
		max-width: 100% !important;
		width: 100% !important;
		margin: 0 auto;
	}
	#ssbInfo p, #ssbInfo li, #ssbInfo label {
		font-size: 16px !important;
		line-height: 1.6 !important;
		height: auto !important;
		width: auto !important;
		min-width: 0 !important;
		max-width: none !important;
		transform: none !important;
	}
	#ssbInfo h2 {
		font-size: 22px !important;
		line-height: 1.3 !important;
		clear: both !important;
		margin-top: 0.4em !important;
	}
	#ssbInfo h2:first-of-type { margin-top: 0 !important; }
	#ssbInfo h3 { font-size: 20px !important; line-height: 1.35 !important; }
	/* Controls table: stacked key/value, no fixed positioning, ~15px type. */
	#ssbInfo table,
	#ssbInfo thead,
	#ssbInfo tbody,
	#ssbInfo tr,
	#ssbInfo th,
	#ssbInfo td {
		display: block !important;
		position: static !important;
		float: none !important;
		left: auto !important;
		top: auto !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		height: auto !important;
		box-sizing: border-box !important;
		font-size: 15px !important;
		transform: none !important;
		zoom: normal !important;
	}
	#ssbInfo thead { display: none !important; }
	#ssbInfo tr { margin: 0 0 10px; border: 1px solid #23394a; }
	#ssbInfo td { border: none; padding: 6px 10px; }
	#ssbInfo td:first-child { color: #7ec8ff; font-weight: 700; padding-bottom: 0; }
	/* Sticky close: right-aligned, not floated over the heading. */
	#ssbInfo .ssb-info-close {
		position: sticky !important;
		top: 0 !important;
		float: none !important;
		display: block !important;
		width: auto !important;
		min-width: 0 !important;
		max-width: none !important;
		margin: 0 0 16px auto !important;
		font-size: 15px !important;
		height: auto !important;
		z-index: 3 !important;
	}
	#ssbInfo .ssb-info-done {
		width: min(86vw, 420px) !important;
		min-width: 0 !important;
		max-width: 100% !important;
		font-size: 16px !important;
		margin: 26px auto 8px !important;
		height: auto !important;
	}
	#ssbInfo div, #ssbInfo nav, #ssbInfo button {
		min-width: 0 !important;
	}
	#ssbInfo .ssb-info-inner {
		margin-top: 0 !important;
		font-size: 16px !important;
	}
}

/* Kill the ~20px right-edge gap under the LOADING overlay on mobile.
   intro.css `div, button { max-width:95% }` under 800px was shrinking #ssbLobbyLoading. */
html, body { overflow-x: hidden !important; }
#ssbLobbyLoading {
	position: fixed !important;
	inset: 0 !important;
	width: 100% !important;
	max-width: none !important;
	min-width: 0 !important;
	height: 100% !important;
	height: 100dvh !important;
	margin: 0 !important;
	box-sizing: border-box !important;
}
#ssbInfo {
	box-sizing: border-box;
	overflow-x: hidden;
}
#ssbInfo .ssb-info-inner {
	max-width: 860px !important;
	box-sizing: border-box;
}


/* Hide the "Sync guest" storage-access chip. The hub iframe is also the
   guest-sync transport (normally a 1px off-screen frame). Do not display:none
   the iframe — that can unload it and break sync. Keep it off-screen even
   when the hub client restyles it as a 150x34 chip. */
iframe[title="Account sync"],
iframe[src*="auth-hub.html"] {
	position: fixed !important;
	left: -9999px !important;
	right: auto !important;
	top: auto !important;
	bottom: 0 !important;
	width: 1px !important;
	height: 1px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: 1px !important;
	max-height: 1px !important;
	margin: 0 !important;
	opacity: 0 !important;
	pointer-events: none !important;
	overflow: hidden !important;
	border: 0 !important;
}


@media (min-width: 801px) {
	#ssbInfo .ssb-info-inner {
		max-width: 860px !important;
		width: 100% !important;
		margin-left: auto !important;
		margin-right: auto !important;
	}
}


/* intro.css sets button{min-width:300px} and, under 800px, button{min-width:95%;font-size:5vw}.
   Keep the shared Ready-to-Play gate's avatar circles, close, and actions at their own sizes. */
#ifs-gate .ig-av {
	width: 44px !important;
	height: 44px !important;
	min-width: 44px !important;
	max-width: 44px !important;
	min-height: 44px !important;
	font-size: 1.6rem !important;
	margin: 0 !important;
	padding: 0 !important;
}
#ifs-gate .ig-x {
	width: auto !important;
	min-width: 0 !important;
	max-width: none !important;
	min-height: 0 !important;
	height: auto !important;
	font-size: 26px !important;
	margin: 0 !important;
	padding: 4px !important;
}
#ifs-gate .ig-btn {
	min-width: 0 !important;
	max-width: 300px !important;
	width: 100% !important;
	font-size: 0.95rem !important;
	margin-left: auto !important;
	margin-right: auto !important;
	margin-top: 0 !important;
}
#ifs-gate p, #ifs-gate h2, #ifs-gate .ig-card, #ifs-gate .ig-avatars, #ifs-gate .ig-or {
	height: auto !important;
	min-width: 0 !important;
	max-width: none;
}
#ifs-gate .ig-card {
	max-width: 400px !important;
	width: 100% !important;
	box-sizing: border-box !important;
}
