/* Good Girls target-theme mobile support. Loaded after the active MyBB theme. */

#logo img {
	display: block;
	width: auto !important;
	height: auto !important;
	max-width: min(100%, 270px) !important;
	max-height: 190px !important;
	object-fit: contain;
}

#logo > .wrapper > a {
	display: block;
	flex: 0 1 auto;
	min-width: 0;
	line-height: 0;
}

#logo ul.top_links {
	position: absolute;
	top: 8px;
	right: 0;
	transform: none;
	margin: 0;
}

#logo ul.top_links a {
	min-height: 0;
	padding-top: 0;
	padding-bottom: 0;
	line-height: 1.3;
}

@media (min-width: 769px) {
	#logo {
		padding: 6px 0 !important;
	}

	#logo .wrapper {
		display: flex;
		align-items: flex-start;
		min-height: 0;
		padding-top: 0;
		padding-bottom: 0;
	}
}

@media (max-width: 768px) {
	#logo {
		padding: 6px 0 !important;
	}

	#logo .wrapper {
		display: block;
		min-height: 0;
		padding-top: 0;
		padding-bottom: 0;
	}

	#logo img {
		max-width: min(100%, 230px) !important;
		max-height: 140px !important;
	}

	#logo ul.top_links {
		position: static;
		transform: none;
		justify-content: flex-start;
		margin: 6px 0 0;
		text-align: left;
	}
}

@media (max-width: 480px) {
	#logo img {
		max-width: min(100%, 210px) !important;
		max-height: 120px !important;
	}

	#header ul.menu {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: flex-start;
		gap: 4px 12px;
	}

	#header ul.menu li,
	#header ul.menu li:last-child {
		width: auto;
		min-width: 0;
		flex: 0 0 auto;
		grid-column: auto;
	}

	#header ul.menu li,
	#header ul.menu:not(.top_links) li a {
		max-width: 100%;
		overflow-wrap: anywhere;
	}

	#header ul.menu li a {
		display: inline-block;
		min-height: 32px;
	}

	#panel .upper .wrapper {
		align-items: flex-start;
	}

	#panel .upper .wrapper > form {
		order: -1;
		flex: 0 0 100%;
		width: 100%;
		margin: 0 0 8px;
	}

	#panel .upper .wrapper > .welcome {
		flex: 0 0 100%;
	}

	#panel .upper .wrapper > form #search {
		width: 100%;
		box-sizing: border-box;
	}

	#panel .upper .wrapper > form #search input.textbox {
		flex: 1 1 auto;
		min-width: 0;
	}

	#panel .upper .wrapper > form #search input.button {
		flex: 0 0 auto;
	}
}


@media (max-width: 600px) {
	/* MyBB forumdisplay has seven cells; keep status, subject, and replies. */
	table.tborder:has(> tbody > tr.inline_row .thread_status) {
		display: block;
		width: 100%;
		overflow: visible;
	}

	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody {
		display: block;
		width: 100%;
	}

	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr:has(> td.thead),
	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr:has(> td.tfoot) {
		display: block;
		width: 100%;
	}

	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr:has(> td.thead) > td,
	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr:has(> td.tfoot) > td {
		display: block;
		box-sizing: border-box;
		width: 100%;
		min-width: 0;
	}

	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr:has(> td.tcat),
	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr.inline_row:has(.thread_status) {
		display: grid;
		grid-template-columns: 42px minmax(0, 1fr) minmax(56px, max-content);
		width: 100%;
	}

	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr:has(> td.tcat) > td,
	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr.inline_row:has(.thread_status) > td {
		display: block;
		box-sizing: border-box;
		width: auto;
		min-width: 0;
		max-width: none;
	}

	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr:has(> td.tcat) > td:first-child {
		grid-column: 1 / 3;
		text-align: left;
	}

	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr:has(> td.tcat) > td:nth-child(2) {
		grid-column: 3;
		text-align: right;
	}

	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr:has(> td.tcat) > td:nth-child(n + 3),
	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr.inline_row:has(.thread_status) > td:nth-child(2),
	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr.inline_row:has(.thread_status) > td:nth-child(n + 5) {
		display: none;
	}

	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr.inline_row:has(.thread_status) > td:nth-child(1) {
		grid-column: 1;
	}

	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr.inline_row:has(.thread_status) > td:nth-child(3) {
		grid-column: 2;
		overflow-wrap: anywhere;
	}

	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr.inline_row:has(.thread_status) > td:nth-child(4) {
		grid-column: 3;
		text-align: right;
	}
}

/* CherryFizz 1.0.6: match MyBB categories directly, including themes without #content. */
.wrapper .navigation {
	margin-bottom: 8px !important;
}

.wrapper .navigation + br {
	display: none !important;
}

table.tborder:has(> tbody[id^="cat_"]) {
	margin-top: 0 !important;
	margin-bottom: 4px !important;
	border-spacing: 0;
}

table.tborder:has(> tbody[id^="cat_"]) + br {
	display: none !important;
}

table.tborder:has(> tbody[id^="cat_"]) > thead > tr > .thead {
	padding: 7px 8px !important;
}

table.tborder > tbody[id^="cat_"] > tr > .tcat {
	padding: 5px 8px !important;
}

table.tborder > tbody[id^="cat_"] > tr > :is(.trow1, .trow2, .trow_shaded) {
	height: auto;
	padding: 8px 6px !important;
	line-height: 1.4;
}

table.tborder > tbody[id^="cat_"] .smalltext {
	line-height: 1.35;
}

table.tborder > tbody[id^="cat_"] > tr:has(.forum_status) > td:first-child {
	width: 38px;
	min-width: 38px;
	padding-left: 6px !important;
	padding-right: 6px !important;
}

.forum_status {
	width: 24px !important;
	height: 24px !important;
	flex-basis: 24px !important;
}

/* Scale the native 16 x 340 sprite; retain the theme's original image URL. */
.thread_status {
	display: inline-block;
	width: 24px !important;
	height: 24px !important;
	background-size: 24px 510px !important;
	vertical-align: middle;
}

.thread_status.dot_folder { background-position: 0 0 !important; }
.thread_status.dot_hotfolder { background-position: 0 -30px !important; }
.thread_status.dot_hotclosefolder { background-position: 0 -60px !important; }
.thread_status.dot_closefolder { background-position: 0 -90px !important; }
.thread_status.dot_newfolder { background-position: 0 -120px !important; }
.thread_status.dot_newhotfolder { background-position: 0 -150px !important; }
.thread_status.dot_newhotclosefolder { background-position: 0 -180px !important; }
.thread_status.dot_newclosefolder { background-position: 0 -210px !important; }
.thread_status.folder { background-position: 0 -240px !important; }
.thread_status.hotfolder { background-position: 0 -270px !important; }
.thread_status.hotclosefolder { background-position: 0 -300px !important; }
.thread_status.closefolder { background-position: 0 -330px !important; }
.thread_status.movefolder { background-position: 0 -360px !important; }
.thread_status.newfolder { background-position: 0 -390px !important; }
.thread_status.newhotfolder { background-position: 0 -420px !important; }
.thread_status.newhotclosefolder { background-position: 0 -450px !important; }
.thread_status.newclosefolder { background-position: 0 -480px !important; }

table.tborder tr.inline_row:has(.thread_status) > td:nth-child(-n + 2) {
	width: 38px !important;
	min-width: 38px !important;
	padding-left: 6px !important;
	padding-right: 6px !important;
}

table.tborder tr.inline_row:has(.thread_status) > td:nth-child(2) img {
	width: 24px !important;
	height: 24px !important;
	max-width: 24px !important;
	max-height: 24px !important;
	object-fit: contain;
	vertical-align: middle;
}

@media (min-width: 601px) and (max-width: 768px) {
	/* The theme renders tables as blocks on tablets; stretch the inner table groups. */
	table.tborder:has(> tbody > tr.inline_row .thread_status) > thead,
	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody {
		display: table;
		width: 100%;
	}
}

@media (max-width: 600px) {
	table.tborder:has(> tbody > tr.inline_row .thread_status) > thead,
	table.tborder:has(> tbody > tr.inline_row .thread_status) > thead > tr,
	table.tborder:has(> tbody > tr.inline_row .thread_status) > thead > tr > td,
	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr:has(> td.trow_sep),
	table.tborder:has(> tbody > tr.inline_row .thread_status) > tbody > tr:has(> td.trow_sep) > td {
		display: block;
		box-sizing: border-box;
		width: 100%;
		min-width: 0;
	}

	table.tborder tr.inline_row:has(.thread_status) > td:first-child {
		width: auto !important;
		min-width: 0 !important;
		padding-left: 4px !important;
		padding-right: 4px !important;
	}

	table.tborder tr.inline_row:has(.thread_status) > td:nth-child(2) {
		display: none;
	}
}

@media (max-width: 480px) {
	table.tborder > tbody[id^="cat_"] > tr > :is(.trow1, .trow2, .trow_shaded) {
		padding-top: 7px !important;
		padding-bottom: 7px !important;
	}
}

