/* Inferno mobile UI source-of-truth.
   Keep mobile layout and component behavior here (no runtime CSS patch chains). */

.inferno-mobile-topnav {
	display: none;
}

.inferno-mobile-topnav-wrap {
	display: none;
}

@media (max-width: 768px) {
	/* Legacy theme response.css hides #panel here; Inferno still needs the panel in the DOM (upper/search). */
	#panel.inferno-panel {
		display: block !important;
	}
}

@media (max-width: 1024px) {
	#container,
	.wrapper,
	.inferno-panel {
		width: 100% !important;
		max-width: 100% !important;
	}

	.inferno-toolbar {
		display: flex !important;
		flex-wrap: wrap;
		gap: 4px;
	}

	.inferno-toolbar-right {
		justify-content: flex-start !important;
	}

	table {
		display: block;
		width: 100% !important;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	/* private.php?action=read (+ quick reply): block tables break post layout / SCEditor width */
	body.inferno-private-read #content table.tborder,
	body.inferno-private-read #quick_reply_form table {
		display: table !important;
		width: 100% !important;
		max-width: 100% !important;
		overflow-x: visible;
		table-layout: fixed;
	}

	body.inferno-private-read #content table.tborder > thead,
	body.inferno-private-read #quick_reply_form table > thead {
		display: table-header-group !important;
	}

	body.inferno-private-read #content table.tborder > tbody,
	body.inferno-private-read #quick_reply_form table > tbody {
		display: table-row-group !important;
	}

	body.inferno-private-read #content table.tborder > tfoot,
	body.inferno-private-read #quick_reply_form table > tfoot {
		display: table-footer-group !important;
	}

	body.inferno-private-read #content table.tborder tr,
	body.inferno-private-read #quick_reply_form table tr {
		display: table-row !important;
	}

	body.inferno-private-read #content table.tborder th,
	body.inferno-private-read #content table.tborder td,
	body.inferno-private-read #quick_reply_form table th,
	body.inferno-private-read #quick_reply_form table td {
		display: table-cell !important;
		vertical-align: top;
	}

	/*
	 * private.php inbox: target ONLY the folder message table (has .tcat header row in thead or tbody).
	 * Do NOT target nested table.tborder inside .thead (PM search) — that was stealing column widths / hiding cells.
	 */
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) {
		display: table !important;
		width: 100% !important;
		min-width: 100% !important;
		max-width: 100% !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
		overflow: visible;
		table-layout: fixed;
		border-collapse: collapse;
		box-sizing: border-box;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child {
		width: 100% !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) > thead {
		display: table-header-group !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) > tbody {
		display: table-row-group !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) > tfoot {
		display: table-footer-group !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tr {
		display: table-row !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) th,
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) td {
		display: table-cell !important;
		vertical-align: middle;
		box-sizing: border-box;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tr:has(> :is(td, th).tcat) :is(td, th).tcat {
		padding-top: 5px !important;
		padding-bottom: 5px !important;
		line-height: 1.25;
	}

	/*
	 * PM folder: .tcat rows = column headers. Message rows have no .tcat in the row.
	 * 6-col body (Inferno private_messagebit): col1 .inferno-pm-status | col2 legacy {$icon} | title | sender | date | cb.
	 * col2 is duplicate of the FA badge on mobile — collapsed. Shrink col1 badge (global.css uses 2.35rem) to tighten the gap to the subject.
	 * 5-col body (icon|title|sender|date|cb): hide col4. 4-col: hide col4. Leading bulk-checkbox: hide col5 (date).
	 * Header 5×.tcat variant → hide col4 (see below).
	 */
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:has(> :is(td, th).tcat:nth-child(5)) > *:nth-child(4) {
		display: none !important;
		width: 0 !important;
		min-width: 0 !important;
		max-width: 0 !important;
		padding: 0 !important;
		margin: 0 !important;
		border: none !important;
		overflow: hidden !important;
		visibility: hidden !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(5)):not(:has(> :nth-child(6))):not(:has(> :is(td, th).tcat)):not(:has(td:first-child input[type="checkbox"])) > *:nth-child(4) {
		display: none !important;
		width: 0 !important;
		min-width: 0 !important;
		max-width: 0 !important;
		padding: 0 !important;
		margin: 0 !important;
		border: none !important;
		overflow: hidden !important;
		visibility: hidden !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(5)):not(:has(> :nth-child(6))):not(:has(> :is(td, th).tcat)):has(td:first-child:has(input[type="checkbox"])) > *:nth-child(5) {
		display: none !important;
		width: 0 !important;
		min-width: 0 !important;
		max-width: 0 !important;
		padding: 0 !important;
		visibility: hidden !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(4)):not(:has(> :nth-child(5))):not(:has(> :is(td, th).tcat)) > *:nth-child(4) {
		display: none !important;
		width: 0 !important;
		min-width: 0 !important;
		max-width: 0 !important;
		padding: 0 !important;
		visibility: hidden !important;
	}

	/*
	 * Message Title header is ONE td[colspan=3] over status | legacy-icon | subject columns; align inset to compact col1+collapsed col2.
	 */
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:has(> :is(td, th).tcat:nth-child(4)):not(:has(> :nth-child(5))) > :is(td, th).tcat[colspan="3"],
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:has(> :is(td, th).tcat:nth-child(4)):not(:has(> :nth-child(5))) > :is(td, th).tcat:nth-child(1):not([colspan]) {
		box-sizing: border-box;
		text-align: left !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:has(> :is(td, th).tcat:nth-child(4)):not(:has(> :nth-child(5))) > :is(td, th).tcat[colspan="3"] {
		padding-left: calc(1.35rem + 6px) !important;
		padding-right: 10px !important;
		vertical-align: middle !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:has(> :is(td, th).tcat:nth-child(4)):not(:has(> :nth-child(5))) > :is(td, th).tcat:nth-child(1):not([colspan]) {
		padding-left: 58px !important;
	}

	/* 4-cell header: … | Sender | Date/Time | checkbox — match body col5 */
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:has(> :is(td, th).tcat:nth-child(4)):not(:has(> :nth-child(5))) > :is(td, th).tcat:nth-child(3) {
		width: 18% !important;
		min-width: 0 !important;
		max-width: none !important;
		text-align: right !important;
		font-size: 0.8rem !important;
		line-height: 1.2 !important;
		white-space: nowrap !important;
		overflow: hidden !important;
		text-overflow: ellipsis !important;
		padding: 6px 6px !important;
		vertical-align: middle !important;
		box-sizing: border-box !important;
	}

	/* 6-col: Date/Time (col5) — compact, fills layout with title/sender */
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(6)):not(:has(> :is(td, th).tcat)) > :nth-child(5) {
		display: table-cell !important;
		visibility: visible !important;
		width: 18% !important;
		min-width: 0 !important;
		max-width: none !important;
		padding: 4px 4px !important;
		font-size: 0.8rem !important;
		line-height: 1.2 !important;
		text-align: right !important;
		vertical-align: middle !important;
		white-space: nowrap !important;
		overflow: hidden !important;
		text-overflow: ellipsis !important;
		box-sizing: border-box !important;
	}

	/* Col1: FA status badge — theme global.css uses 2.35rem; shrink so subject sits closer to the icon strip */
	body.inferno-private-list #content tbody .inferno-pm-status {
		width: 1.35rem !important;
		height: 1.35rem !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
	}

	body.inferno-private-list #content tbody .inferno-pm-status::before {
		font-size: 0.72rem !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(6)):not(:has(> :is(td, th).tcat)) > :nth-child(1) {
		width: 26px !important;
		max-width: 26px !important;
		text-align: center;
		vertical-align: middle;
		padding: 2px 1px !important;
		box-sizing: border-box;
		overflow: hidden !important;
	}

	/* Col2: stock MyBB envelope PNG — redundant with .inferno-pm-status; collapse column + hide img so layout stays aligned */
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(6)):not(:has(> :is(td, th).tcat)) > :nth-child(2) {
		width: 0 !important;
		min-width: 0 !important;
		max-width: 0 !important;
		padding: 0 !important;
		margin: 0 !important;
		border: none !important;
		overflow: hidden !important;
		visibility: collapse !important;
		font-size: 0 !important;
		line-height: 0 !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(6)):not(:has(> :is(td, th).tcat)) > :nth-child(2) img {
		display: none !important;
		width: 0 !important;
		height: 0 !important;
		margin: 0 !important;
		padding: 0 !important;
		border: none !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(6)):not(:has(> :is(td, th).tcat)) > :nth-child(6) {
		width: 40px !important;
		max-width: 40px !important;
		padding: 4px 6px 4px 2px !important;
		text-align: center;
		box-sizing: border-box;
		vertical-align: top;
	}

	/* 6-col: message title (col3) — shares row with sender + date */
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(6)):not(:has(> :is(td, th).tcat)) > :nth-child(3) {
		overflow: hidden !important;
		text-align: left !important;
		vertical-align: middle !important;
		padding: 4px 6px 4px 2px !important;
		line-height: 1.25;
		min-width: 0 !important;
		width: 26% !important;
		max-width: none !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(6)):not(:has(> :is(td, th).tcat)) > :nth-child(3)[width] {
		width: 26% !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(6)):not(:has(> :is(td, th).tcat)) > :nth-child(3) a {
		display: block;
		width: 100%;
		max-width: 100%;
		margin: 0;
		white-space: nowrap !important;
		overflow: hidden !important;
		text-overflow: ellipsis !important;
	}

	/* 6-col: sender (col4) */
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(6)):not(:has(> :is(td, th).tcat)) > :nth-child(4) {
		overflow: hidden !important;
		text-align: left !important;
		vertical-align: middle !important;
		padding: 4px 6px 4px 4px !important;
		line-height: 1.25;
		min-width: 0 !important;
		width: 22% !important;
		max-width: none !important;
		white-space: nowrap !important;
		text-overflow: ellipsis !important;
	}

	/* Icon + checkbox columns — 5-col message rows only (no .tcat in row) */
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(5)):not(:has(> :nth-child(6))):not(:has(> :is(td, th).tcat)) > :nth-child(1) {
		width: 36px !important;
		max-width: 36px !important;
		text-align: center;
		vertical-align: top;
		padding: 4px 2px !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(5)):not(:has(> :nth-child(6))):not(:has(> :is(td, th).tcat)) > :nth-child(5) {
		width: 36px !important;
		max-width: 36px !important;
		padding: 4px 6px 4px 2px !important;
		text-align: center;
		box-sizing: border-box;
		vertical-align: top;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(4)):not(:has(> :nth-child(5))):not(:has(> :is(td, th).tcat)) > :nth-child(1) {
		width: 36px !important;
		max-width: 36px !important;
		text-align: center;
		vertical-align: top;
		padding: 4px 2px !important;
	}

	/* Title + sender: 5-col rows (cols 2–3) */
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(5)):not(:has(> :nth-child(6))):not(:has(> :is(td, th).tcat)) > :nth-child(2),
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(5)):not(:has(> :nth-child(6))):not(:has(> :is(td, th).tcat)) > :nth-child(3) {
		overflow: hidden;
		text-align: left !important;
		vertical-align: top;
		padding: 4px 6px 4px 4px !important;
		white-space: normal !important;
		word-break: break-word;
		overflow-wrap: anywhere;
		line-height: 1.22;
		min-width: 0;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(5)):not(:has(> :nth-child(6))):not(:has(> :is(td, th).tcat)) > :nth-child(2) {
		width: 38% !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(5)):not(:has(> :nth-child(6))):not(:has(> :is(td, th).tcat)) > :nth-child(3) {
		width: auto !important;
		min-width: 0 !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(4)):not(:has(> :nth-child(5))):not(:has(> :is(td, th).tcat)) > :nth-child(2),
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) tbody tr:has(> :nth-child(4)):not(:has(> :nth-child(5))):not(:has(> :is(td, th).tcat)) > :nth-child(3) {
		text-align: left !important;
		vertical-align: top;
		padding: 4px 6px !important;
		white-space: normal !important;
		word-break: break-word;
		overflow-wrap: anywhere;
		line-height: 1.22;
		min-width: 0;
	}

	/* PM search row: real table + narrow keywords cell (global `table{display:block}` breaks this) */
	body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder {
		display: table !important;
		width: 100% !important;
		max-width: 100%;
		table-layout: fixed;
		box-sizing: border-box;
	}

	body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder > tbody {
		display: table-row-group !important;
	}

	body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder tr {
		display: table-row !important;
	}

	body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder td {
		display: table-cell !important;
		vertical-align: middle;
		width: auto;
		max-width: 100%;
		box-sizing: border-box;
	}

	body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder td:has(input[name="keywords"]) {
		width: auto;
		min-width: 0;
		max-width: 100%;
	}

	body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder td:has(input[type="submit"]),
	body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder td:has(input.button) {
		width: 1%;
		white-space: nowrap;
	}

	body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder td:has(a[href*="advanced_search"]),
	body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder td:has(a[href*="action=advanced_search"]) {
		width: 1%;
		max-width: 42%;
		white-space: nowrap;
	}

	body.inferno-private-list #content input.textbox[name="keywords"],
	body.inferno-private-list #content input[name="keywords"] {
		width: 100% !important;
		max-width: 100%;
		min-width: 0;
		box-sizing: border-box;
		font-size: 14px !important;
		padding: 5px 10px !important;
		line-height: 1.25 !important;
		min-height: 0 !important;
		max-height: 2.75rem !important;
		height: 2.5rem !important;
		resize: none !important;
		flex: 0 0 auto !important;
	}

	body.inferno-private:not(.inferno-private-list) #content input.textbox[name="keywords"],
	body.inferno-private:not(.inferno-private-list) #content input[name="keywords"] {
		width: 100% !important;
		max-width: 100%;
		min-width: 0;
		box-sizing: border-box;
	}

	body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder .button {
		margin-top: 0;
		margin-right: 6px;
		white-space: nowrap;
	}

	/*
	 * Folder title + PM quick search. Prefer .inferno-pm-folder-toolbar inside td (see usercp_inferno_visual.php):
	 * flex stays on the inner div so <td> stays table-cell and colspan=6 can span full width on mobile.
	 */
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) {
		display: table-cell !important;
		white-space: normal !important;
		box-sizing: border-box;
		width: 100% !important;
		overflow: visible !important;
		padding: 12px 12px 12px 10px !important;
		vertical-align: top !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar {
		display: flex !important;
		flex-direction: column-reverse !important;
		flex-wrap: nowrap;
		align-items: stretch !important;
		gap: 10px;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar > strong {
		display: block;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		padding: 2px 6px 0 8px;
		margin: 0;
		line-height: 1.3;
		white-space: normal !important;
		word-break: normal;
		overflow-wrap: anywhere;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar > b:first-child {
		display: block;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		padding: 2px 6px 0 8px;
		margin: 0;
		line-height: 1.3;
		white-space: normal !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar .float_right {
		flex: 0 0 auto;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		float: none !important;
		clear: both !important;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 8px;
		box-sizing: border-box;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar form:has(input[name="keywords"]) {
		flex: 0 0 auto;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		float: none !important;
		clear: both !important;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 8px;
		box-sizing: border-box;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar .float_right input[name="keywords"],
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar form input[name="keywords"] {
		flex: 0 0 auto !important;
		min-width: 0 !important;
		height: 2.5rem !important;
		max-height: 2.75rem !important;
		line-height: 1.25 !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar .inferno-pm-advanced-inline {
		display: block;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		white-space: nowrap !important;
		overflow: hidden;
		text-overflow: ellipsis;
		text-align: center;
		margin-top: 4px;
		line-height: 1.35;
		font-size: 0.95rem;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar .inferno-pm-advanced-inline a {
		white-space: nowrap !important;
		display: inline;
	}

	body.inferno-private-list #content :is(td, th).thead .float_right .inferno-pm-advanced-inline {
		display: block;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		white-space: nowrap !important;
		overflow: hidden;
		text-overflow: ellipsis;
		text-align: center;
		margin-top: 4px;
		line-height: 1.35;
		font-size: 0.95rem;
	}

	body.inferno-private-list #content :is(td, th).thead .float_right .inferno-pm-advanced-inline a {
		white-space: nowrap !important;
		display: inline;
	}

	/* Legacy markup without injected wrapper: flex must stay on <td> (narrow strip risk) */
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]):not(:has(.inferno-pm-folder-toolbar)) {
		display: flex !important;
		flex-direction: column-reverse !important;
		flex-wrap: nowrap;
		align-items: stretch !important;
		align-self: stretch !important;
		gap: 10px;
		white-space: normal !important;
		box-sizing: border-box;
		width: 100% !important;
		min-width: 100% !important;
		max-width: 100% !important;
		min-height: 0;
		overflow: visible !important;
		padding: 12px 12px 12px 10px !important;
		vertical-align: top !important;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]):not(:has(.inferno-pm-folder-toolbar)) > strong {
		display: block;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		padding: 2px 6px 0 8px;
		margin: 0;
		line-height: 1.3;
		white-space: normal !important;
		word-break: normal;
		overflow-wrap: anywhere;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]):not(:has(.inferno-pm-folder-toolbar)) .float_right {
		flex: 0 0 auto;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		float: none !important;
		clear: both !important;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 8px;
		box-sizing: border-box;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]):not(:has(.inferno-pm-folder-toolbar)) form:has(input[name="keywords"]) {
		flex: 0 0 auto;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		float: none !important;
		clear: both !important;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 8px;
		box-sizing: border-box;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]):not(:has(.inferno-pm-folder-toolbar)) .float_right input[name="keywords"],
	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]):not(:has(.inferno-pm-folder-toolbar)) form input[name="keywords"] {
		flex: 0 0 auto !important;
		min-width: 0 !important;
		height: 2.5rem !important;
		max-height: 2.75rem !important;
		line-height: 1.25 !important;
	}

	/* Narrow phones: stack PM search (keyword / submit / advanced) so nothing clips off-screen */
	@media (max-width: 640px) {
		body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar .float_right,
		body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar form:has(input[name="keywords"]),
		body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]):not(:has(.inferno-pm-folder-toolbar)) .float_right,
		body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]):not(:has(.inferno-pm-folder-toolbar)) form:has(input[name="keywords"]) {
			flex-direction: column !important;
			align-items: stretch !important;
		}

		body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar .float_right input[type="submit"],
		body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar .float_right .button,
		body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]):not(:has(.inferno-pm-folder-toolbar)) .float_right input[type="submit"],
		body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]):not(:has(.inferno-pm-folder-toolbar)) .float_right .button {
			width: 100% !important;
			box-sizing: border-box;
			margin: 0 !important;
		}

		body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar .float_right input[name="keywords"],
		body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]) .inferno-pm-folder-toolbar form input[name="keywords"],
		body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]):not(:has(.inferno-pm-folder-toolbar)) .float_right input[name="keywords"],
		body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) :is(thead, tbody) tr:first-child > :is(td, th).thead:has(input[name="keywords"]):not(:has(.inferno-pm-folder-toolbar)) form input[name="keywords"] {
			flex: 0 0 auto !important;
			height: 2.5rem !important;
			min-height: 0 !important;
			max-height: 2.75rem !important;
		}

		body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder,
		body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder > tbody {
			display: block !important;
			width: 100% !important;
			max-width: 100% !important;
		}

		body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder tr {
			display: block !important;
			width: 100% !important;
		}

		body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder td {
			display: block !important;
			width: 100% !important;
			max-width: 100% !important;
			white-space: normal !important;
			box-sizing: border-box;
			padding: 4px 0 !important;
		}

		body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder td:has(input[type="submit"]),
		body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder td:has(input.button) {
			padding-top: 8px !important;
		}

		body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder .button,
		body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder input[type="submit"] {
			width: 100%;
			box-sizing: border-box;
			margin: 0 !important;
		}

		body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder td:has(a[href*="advanced_search"]),
		body.inferno-private-list #content form:has(input[name="keywords"]) table.tborder td:has(a[href*="action=advanced_search"]) {
			text-align: center;
			padding-top: 6px !important;
		}
	}

	body.inferno-private-list #content {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box;
	}

	body.inferno-private-list #content .wrapper {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box;
	}

	body.inferno-usercp.inferno-private-list #container,
	body.inferno-usercp.inferno-private-list #main {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box;
	}

	body.inferno-usercp.inferno-private-list .inferno-ucp-main-cell,
	body.inferno-usercp.inferno-private-list .inferno-ucp-layout-table {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box;
	}

	/*
	 * UserCP Personal Notepad: global `table{display:block}` widens/crops the card; SCEditor must stay ≤ content width.
	 */
	body.inferno-usercp:has(.inferno-ucp-notepad-wrap) #container,
	body.inferno-usercp:has(.inferno-ucp-notepad-wrap) #main,
	body.inferno-usercp:has(.inferno-ucp-notepad-wrap) #content,
	body.inferno-usercp:has(.inferno-ucp-notepad-wrap) #content > .wrapper {
		min-width: 0 !important;
		max-width: 100% !important;
		box-sizing: border-box !important;
	}

	/*
	 * Restore display:table on outer UserCP layout + inner card (mobile rule forces table{display:block}).
	 */
	body.inferno-usercp:has(.inferno-ucp-notepad-wrap) table:has(td .inferno-ucp-notepad-wrap) {
		display: table !important;
		table-layout: fixed !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		overflow-x: visible !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp:has(.inferno-ucp-notepad-wrap) table:has(td .inferno-ucp-notepad-wrap) > thead {
		display: table-header-group !important;
	}

	body.inferno-usercp:has(.inferno-ucp-notepad-wrap) table:has(td .inferno-ucp-notepad-wrap) > tbody {
		display: table-row-group !important;
	}

	body.inferno-usercp:has(.inferno-ucp-notepad-wrap) table:has(td .inferno-ucp-notepad-wrap) tr {
		display: table-row !important;
	}

	body.inferno-usercp:has(.inferno-ucp-notepad-wrap) table:has(td .inferno-ucp-notepad-wrap) td,
	body.inferno-usercp:has(.inferno-ucp-notepad-wrap) table:has(td .inferno-ucp-notepad-wrap) th {
		display: table-cell !important;
		min-width: 0 !important;
		max-width: 100% !important;
		box-sizing: border-box !important;
		vertical-align: top !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap),
	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) table.tborder {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) table.tborder {
		display: table !important;
		table-layout: fixed !important;
		border-collapse: collapse !important;
		overflow-x: visible !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) table.tborder > thead {
		display: table-header-group !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) table.tborder > tbody {
		display: table-row-group !important;
		width: 100% !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) table.tborder tr {
		display: table-row !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) table.tborder td,
	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) table.tborder th {
		display: table-cell !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
		vertical-align: top !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-wrap {
		display: block !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-wrap .sceditor-container,
	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-wrap .sceditor-container .sceditor {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-wrap .sceditor-container iframe {
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box !important;
	}

	/*
	 * Toolbar: four-column grid of .sceditor-group cells (beats global.css nowrap + uneven wrapping).
	 */
	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) div.sceditor-toolbar,
	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-wrap div.sceditor-toolbar {
		display: grid !important;
		grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
		grid-auto-rows: auto !important;
		align-items: stretch !important;
		justify-items: stretch !important;
		gap: 8px 6px !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
		overflow-x: visible !important;
		overflow-y: visible !important;
		padding: 6px 4px !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) div.sceditor-toolbar > * {
		min-width: 0 !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) div.sceditor-toolbar .sceditor-group {
		display: inline-flex !important;
		flex-wrap: wrap !important;
		align-items: center !important;
		justify-content: center !important;
		align-content: center !important;
		flex: none !important;
		width: 100% !important;
		margin: 0 !important;
		box-sizing: border-box !important;
		padding: 4px 2px !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) div.sceditor-toolbar .sceditor-button {
		flex: 0 0 auto !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) textarea.usercp_notepad {
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box !important;
	}

	/* Preview / Update: stretch to parent width (center + align-items:center shrinks inputs and clips); no 100vw math */
	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-actions {
		display: flex !important;
		flex-direction: column !important;
		align-items: stretch !important;
		justify-content: flex-start !important;
		gap: 10px !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
		padding: 12px 0 16px !important;
		margin: 0 !important;
		text-align: center !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-actions input.button,
	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-actions input[type="submit"] {
		display: block !important;
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box !important;
		margin: 0 auto !important;
		padding-left: 12px !important;
		padding-right: 12px !important;
		text-align: center !important;
	}

	body.inferno-usercp:has(#inferno-convo-widget-btn) #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-actions {
		padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
	}

	body.inferno-usercp #content td:has(.inferno-ucp-notepad-wrap) {
		min-width: 0 !important;
		max-width: 100% !important;
		overflow-x: visible !important;
		box-sizing: border-box !important;
	}

	.tborder,
	.thead,
	.trow1,
	.trow2,
	.tfoot {
		max-width: 100% !important;
	}

	img {
		max-width: 100%;
		height: auto;
	}
}

/*
 * Personal Notepad: ~iPhone SE / 375px — loads after EOF ≤550px block; tighter toolbar + actions.
 */
@media (max-width: 400px) {
	body.inferno-usercp #content:has(.inferno-ucp-notepad-wrap) {
		padding-left: max(6px, env(safe-area-inset-left, 0px)) !important;
		padding-right: max(6px, env(safe-area-inset-right, 0px)) !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) div.sceditor-toolbar,
	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-wrap div.sceditor-toolbar {
		gap: 5px 3px !important;
		padding: 4px 2px !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) div.sceditor-toolbar .sceditor-group {
		padding: 2px 1px !important;
		gap: 2px !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) div.sceditor-toolbar .sceditor-button {
		width: 24px !important;
		height: 24px !important;
		min-width: 24px !important;
		min-height: 24px !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-actions {
		width: 100% !important;
		max-width: 100% !important;
		padding-left: max(4px, env(safe-area-inset-left, 0px)) !important;
		padding-right: max(4px, env(safe-area-inset-right, 0px)) !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-actions input.button,
	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-actions input[type="submit"] {
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box !important;
		padding-left: 10px !important;
		padding-right: 10px !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-wrap .sceditor-container iframe {
		min-height: 180px !important;
	}
}

@media (max-width: 980px) {
	html {
		-webkit-text-size-adjust: 100%;
		text-size-adjust: 100%;
		overflow-x: hidden;
		max-width: 100%;
	}

	body {
		font-size: 17px;
		line-height: 1.5;
		overflow-x: hidden;
		max-width: 100%;
	}

	/* Do not break chat.php?embed=1 (iframe): it needs html/body height 100% for the flex shell. */
	html:not(.inferno-convo-embed),
	body:not(.inferno-convo-embed) {
		height: auto !important;
		min-height: 0 !important;
	}

	body:has(#panel.inferno-panel),
	body.inferno-index,
	body.inferno-search,
	body.inferno-forum {
		min-height: 0 !important;
	}

	#container {
		display: block !important;
		min-height: unset !important;
		height: auto !important;
		width: 100% !important;
		max-width: 100% !important;
	}

	/* Theme uses #footer { flex: 1 1 auto } inside a 100vh flex #container — leaves a tall empty band above/below footer on phones. */
	#footer {
		flex: 0 0 auto !important;
		flex-grow: 0 !important;
		flex-shrink: 0 !important;
		justify-content: flex-start !important;
	}

	#content {
		display: block !important;
		flex: none !important;
		min-height: 0 !important;
		height: auto !important;
		padding-bottom: 0 !important;
		margin-bottom: 0 !important;
		padding: 0 10px !important;
	}

	/* Breadcrumb: hide `.inferno-bc-right` (active page title like "Board — payment received…"); it wraps under the path on phones and duplicates the main page heading. */
	.inferno-breadcrumb-bar .inferno-bc-right {
		display: none !important;
	}

	.inferno-breadcrumb-bar .inferno-bc-row {
		justify-content: flex-start;
	}

	/* private list: PM table column rules are in the max-width:1024 block */

	body.inferno-private:not(.inferno-private-read) #content table.tborder tr :is(td, th).thead:not(:has(input[name="keywords"])) {
		max-width: 100%;
		box-sizing: border-box;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	body.inferno-private:not(.inferno-private-read) #content fieldset {
		max-width: 100%;
		min-width: 0;
		box-sizing: border-box;
		overflow: visible;
	}

	body.inferno-private:not(.inferno-private-read) #content fieldset .smalltext {
		display: block;
		max-width: 100%;
		white-space: normal !important;
		overflow-wrap: anywhere;
		word-break: break-word;
		line-height: 1.45;
	}

	body.inferno-private .pmspace {
		width: 100%;
		max-width: 100%;
		min-width: 0;
		box-sizing: border-box;
		white-space: normal !important;
		overflow: visible;
	}

	body.inferno-private .pmspace_container {
		min-width: 0;
		max-width: 100%;
		box-sizing: border-box;
		vertical-align: middle;
	}

	body.inferno-private #content a[href*="action=advanced_search"],
	body.inferno-private #content a[href*="advanced_search"] {
		white-space: normal;
		display: inline-block;
		max-width: 100%;
		line-height: 1.35;
	}

	body.inferno-private #content {
		overflow-x: hidden;
		max-width: 100%;
	}

	/* PM folder list: full usable width — theme padding was leaving empty bands beside the table */
	body.inferno-private-list #content {
		overflow-x: visible;
		max-width: 100%;
		box-sizing: border-box;
		padding-left: 0 !important;
		padding-right: 0 !important;
	}

	body.inferno-private-list #container {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box;
	}

	body.inferno-private-list #main {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box;
	}

	body.inferno-usercp.inferno-private-list .inferno-ucp-main-cell,
	body.inferno-usercp.inferno-private-list .inferno-ucp-layout-table {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box;
	}

	body.inferno-private-list #content table.tborder:has(:is(thead, tbody) tr :is(td, th).tcat) {
		width: 100% !important;
		min-width: 100% !important;
		max-width: 100% !important;
		table-layout: fixed;
	}

	/* private.php?action=read — stack author + body; kill legacy float/% widths; subject ellipsis */
	body.inferno-private-read #content table.tborder .thead strong,
	body.inferno-private-read #content table.tborder td.thead {
		display: block;
		max-width: 100%;
		box-sizing: border-box;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	/* Classic + horizontal postbit layouts: single column, centered author strip */
	body.inferno-private-read .post.classic,
	body.inferno-private-read .post:not(.classic) {
		display: flex !important;
		flex-direction: column !important;
		align-items: stretch !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box;
		overflow: visible !important;
	}

	body.inferno-private-read .post.classic .post_author,
	body.inferno-private-read .post:not(.classic) .post_author {
		order: 1;
		float: none !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		margin-left: auto !important;
		margin-right: auto !important;
		align-self: center !important;
		text-align: center !important;
		grid-area: unset !important;
		position: static !important;
		border-radius: 10px !important;
		box-sizing: border-box;
	}

	body.inferno-private-read .post.classic .post_content,
	body.inferno-private-read .post:not(.classic) .post_content {
		order: 2;
		float: none !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		display: block !important;
		clear: both !important;
		box-sizing: border-box !important;
		grid-area: unset !important;
		overflow-x: hidden;
	}

	body.inferno-private-read .post.classic .post_controls,
	body.inferno-private-read .post:not(.classic) .post_controls {
		order: 3;
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box;
	}

	body.inferno-private-read .post .post_body,
	body.inferno-private-read .post .post_content,
	body.inferno-private-read .post .post_message {
		overflow-wrap: anywhere;
		word-break: break-word;
		max-width: 100%;
		min-width: 0;
		box-sizing: border-box;
	}

	body.inferno-private-read .post.classic .post_author div.author_avatar,
	body.inferno-private-read .post.classic .post_author div.author_information,
	body.inferno-private-read .post.classic .post_author div.author_statistics,
	body.inferno-private-read .post:not(.classic) .post_author div.author_avatar,
	body.inferno-private-read .post:not(.classic) .post_author div.author_information,
	body.inferno-private-read .post:not(.classic) .post_author div.author_statistics {
		float: none !important;
		text-align: center !important;
		margin-left: auto !important;
		margin-right: auto !important;
	}

	body.inferno-private-read .post .post_controls {
		max-width: 100% !important;
		box-sizing: border-box;
		overflow: visible !important;
		padding: 8px 6px !important;
	}

	/* One compact centered row (wraps to 2nd line if needed); fits viewport */
	body.inferno-private-read .post .post_controls .postbit_buttons {
		display: flex !important;
		flex-wrap: wrap !important;
		align-items: center !important;
		justify-content: center !important;
		gap: 6px !important;
		row-gap: 8px !important;
		max-width: 100% !important;
		box-sizing: border-box;
	}

	body.inferno-private-read .post .post_controls .postbit_buttons > a {
		flex: 0 0 auto;
		margin: 0 !important;
		box-sizing: border-box;
	}

	/* Author strip: profile / find / rep etc. — one centered group, wraps within viewport */
	body.inferno-private-read .post .post_author .postbit_buttons,
	body.inferno-private-read .post .post_author .author_buttons {
		display: flex !important;
		flex-wrap: wrap !important;
		align-items: center !important;
		justify-content: center !important;
		gap: 6px !important;
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box;
		text-align: center !important;
		float: none !important;
	}

	body.inferno-private-read .post .post_author .postbit_buttons > a {
		flex: 0 0 auto;
		margin: 0 !important;
	}

	/* Quick reply: full-width editor shell + footer buttons stack (Preview no longer clipped) */
	body.inferno-private-read #quick_reply_form {
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box;
	}

	body.inferno-private-read #quick_reply_form .sceditor-container,
	body.inferno-private-read #quick_reply_form #message,
	body.inferno-private-read #quick_reply_form #quickreply_e {
		max-width: 100% !important;
		box-sizing: border-box;
	}

	body.inferno-private-read #quick_reply_form table td {
		min-width: 0;
	}

	body.inferno-private-read #quick_reply_form td.tfoot,
	body.inferno-private-read #quick_reply_form td.inferno_qr_tfoot {
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box;
		text-align: center !important;
	}

	body.inferno-private-read #quick_reply_form td.tfoot .inferno_qr_tfoot_inner,
	body.inferno-private-read #quick_reply_form .inferno_qr_tfoot_inner {
		display: flex !important;
		flex-wrap: wrap !important;
		align-items: center !important;
		justify-content: center !important;
		gap: 8px !important;
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box;
	}

	body.inferno-private-read #quick_reply_form td.tfoot input.button,
	body.inferno-private-read #quick_reply_form td.inferno_qr_tfoot input.button,
	body.inferno-private-read #quick_reply_form td.tfoot input[type="submit"],
	body.inferno-private-read #quick_reply_form td.inferno_qr_tfoot input[type="submit"] {
		margin: 6px 4px !important;
		max-width: min(100%, 280px);
		box-sizing: border-box;
	}

	body.inferno-private-read:has(#inferno-convo-widget-btn) #quick_reply_form {
		padding-bottom: 56px;
	}

	/* Icon-only labels for PM reply / forward / delete (and reply-all) to save horizontal space */
	body.inferno-private-read .postbit_buttons a.postbit_reply_pm span,
	body.inferno-private-read .postbit_buttons a.postbit_reply_all span,
	body.inferno-private-read .postbit_buttons a.postbit_forward_pm span,
	body.inferno-private-read .postbit_buttons a.postbit_delete_pm span {
		font-size: 0 !important;
		line-height: 0 !important;
		padding-left: 0 !important;
		color: transparent !important;
		text-shadow: none !important;
	}

	body.inferno-private-read .postbit_buttons a.postbit_reply_pm span::before,
	body.inferno-private-read .postbit_buttons a.postbit_reply_all span::before,
	body.inferno-private-read .postbit_buttons a.postbit_forward_pm span::before,
	body.inferno-private-read .postbit_buttons a.postbit_delete_pm span::before {
		font-size: 15px !important;
		line-height: 1 !important;
		color: #ffb3df !important;
		position: static !important;
		left: auto !important;
		top: auto !important;
		transform: none !important;
		width: auto !important;
		text-align: center !important;
		opacity: 1 !important;
	}

	body.inferno-private-read .postbit_buttons a.postbit_delete_pm span::before {
		color: #ff6b81 !important;
	}

	body.inferno-private-read .postbit_buttons a.postbit_reply_pm,
	body.inferno-private-read .postbit_buttons a.postbit_reply_all,
	body.inferno-private-read .postbit_buttons a.postbit_forward_pm,
	body.inferno-private-read .postbit_buttons a.postbit_delete_pm {
		padding: 8px 12px !important;
		min-width: 42px;
		min-height: 40px;
		display: inline-flex !important;
		align-items: center !important;
		justify-content: center !important;
	}

	/* chat.php (full-page): mobile #container/#content use display:block above — that breaks the flex chain and leaves chat hugging the header. Restore flex for this body class only. */
	body.inferno-convo-page {
		min-height: 100dvh !important;
		display: flex !important;
		flex-direction: column !important;
	}

	body.inferno-convo-page #container {
		display: flex !important;
		flex-direction: column !important;
		flex: 1 1 auto !important;
		min-height: 0 !important;
		height: auto !important;
		width: 100% !important;
		max-width: 100% !important;
	}

	body.inferno-convo-page #content {
		display: flex !important;
		flex-direction: column !important;
		flex: 1 1 auto !important;
		min-height: 0 !important;
		height: auto !important;
		padding: 0 10px !important;
	}

	body.inferno-convo-page #content > .wrapper {
		display: flex !important;
		flex-direction: column !important;
		flex: 1 1 auto !important;
		min-height: 0 !important;
	}

	body.inferno-convo-page #inferno-convo.inferno-marketcp:not(.inferno-convo--embed) {
		max-height: none !important;
		min-height: 0 !important;
		flex: 1 1 0% !important;
	}

	body.inferno-convo-page #footer {
		flex: 0 0 auto !important;
		flex-grow: 0 !important;
		flex-shrink: 0 !important;
	}

	.wrapper {
		min-height: 0 !important;
	}

	#footer {
		display: block !important;
		flex: none !important;
		margin-top: 10px !important;
		margin-bottom: 0 !important;
		position: relative !important;
		left: auto;
		right: auto;
		bottom: auto;
		z-index: auto;
		clear: both !important;
	}

	#footer .upper,
	#footer .lower {
		padding-left: 10px !important;
		padding-right: 10px !important;
	}

	body:has(#panel.inferno-panel)::before,
	body.inferno-index::before,
	body.inferno-search::before {
		min-height: 0 !important;
	}

	.thead,
	.tcat {
		font-size: 16px !important;
	}

	.trow1,
	.trow2,
	.smalltext,
	td {
		font-size: 16px !important;
		line-height: 1.5 !important;
	}

	.post .post_content,
	.post_body,
	.post_message {
		font-size: 17px !important;
		line-height: 1.6 !important;
	}

	.button,
	input.button {
		font-size: 15px !important;
		padding: 9px 13px !important;
	}

	#panel .upper .wrapper,
	#panel .upper .inferno-upper-inner {
		display: flex !important;
		flex-wrap: wrap;
		gap: 8px;
		align-items: center;
	}

	/* Mobile top navbar */
	#panel .lower.inferno-member-toolbar,
	#panel .lower.inferno-guest-toolbar {
		display: none !important;
	}

	html.inferno-mobile-topnav-ready #container {
		padding-top: 62px !important;
	}

	.inferno-mobile-topnav-wrap {
		display: block;
		position: fixed;
		left: 8px;
		right: 8px;
		top: max(6px, env(safe-area-inset-top));
		z-index: 12050;
		pointer-events: none;
	}

	.inferno-mobile-topnav-wrap > * {
		pointer-events: auto;
	}

	.inferno-mobile-topnav {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 4px;
		flex-wrap: nowrap;
		background: rgba(14, 10, 18, 0.97);
		border: 1px solid rgba(255, 45, 160, 0.42);
		border-radius: 10px;
		padding: 6px 6px;
		box-shadow: 0 10px 24px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.06);
	}

	.inferno-mobile-topnav-cluster--left {
		display: flex;
		align-items: center;
		gap: 10px;
		flex: 0 0 auto;
	}

	/* Clicks must hit the <button>, not children (avoids opening search when tapping the avatar edge). */
	.inferno-mobile-avatar-btn .inferno-mobile-avatar-ring,
	.inferno-mobile-avatar-btn .inferno-mobile-caret,
	.inferno-mobile-avatar-btn .inferno-mobile-avatar-img,
	.inferno-mobile-avatar-btn .inferno-mobile-avatar-fallback,
	.imtn-btn--search .inferno-mobile-caret--inline,
	.imtn-btn--search .fas {
		pointer-events: none;
	}

	.inferno-mobile-topnav .imtn-btn,
	.inferno-mobile-topnav a.imtn-link {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 38px;
		width: 38px;
		height: 38px;
		padding: 0;
		border-radius: 8px;
		color: #f8e9f4 !important;
		text-decoration: none !important;
		background: transparent;
		border: 1px solid transparent;
		box-sizing: border-box;
	}

	.inferno-mobile-topnav .imtn-btn {
		cursor: pointer;
		-webkit-appearance: none;
		appearance: none;
	}

	.inferno-mobile-topnav .imtn-btn:active,
	.inferno-mobile-topnav a.imtn-link:active {
		transform: translateY(1px);
	}

	.inferno-mobile-topnav a.imtn-link .inferno-toolbar-count {
		position: absolute;
		bottom: 2px;
		right: 2px;
		font-size: 9px;
		font-weight: 700;
		line-height: 1;
		padding: 0;
		background: transparent;
	}

	.inferno-mobile-topnav a.imtn-link {
		position: relative;
	}

	.inferno-mobile-avatar-btn {
		position: relative;
		width: 40px !important;
		min-width: 40px !important;
		height: 40px !important;
		border-radius: 50% !important;
		padding: 0 !important;
		background: rgba(255, 255, 255, 0.12) !important;
		border: 1px solid rgba(255, 255, 255, 0.2) !important;
	}

	.inferno-mobile-avatar-ring {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 34px;
		height: 34px;
		border-radius: 50%;
		overflow: hidden;
		background: rgba(20, 20, 24, 0.9);
	}

	.inferno-mobile-avatar-img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		display: block;
	}

	.inferno-mobile-avatar-fallback {
		color: #c8c0d0;
		font-size: 16px;
	}

	.inferno-mobile-caret {
		position: absolute;
		bottom: 2px;
		left: 2px;
		width: 0;
		height: 0;
		border-left: 4px solid transparent;
		border-right: 4px solid transparent;
		border-top: 5px solid #f0e8f4;
	}

	.inferno-mobile-caret--inline {
		position: static;
		display: inline-block;
		margin-left: 1px;
		border-left: 3px solid transparent;
		border-right: 3px solid transparent;
		border-top: 4px solid #f0e8f4;
		vertical-align: middle;
	}

	.imtn-btn--search {
		min-width: 40px !important;
		width: 40px !important;
		gap: 0;
		flex-direction: row;
	}

	.inferno-mobile-menu-btn {
		background: linear-gradient(180deg, rgba(120, 40, 160, 0.98), rgba(70, 20, 110, 0.98)) !important;
		border: 1px solid rgba(255, 200, 255, 0.45) !important;
		color: #fff !important;
	}

	.inferno-mobile-notif-mount {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 38px;
		height: 38px;
	}

	.inferno-mobile-notif-mount .inferno-notif-li {
		position: relative;
		list-style: none;
		margin: 0;
		padding: 0;
	}

	.inferno-mobile-notif-mount #inferno-notif-btn {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 38px;
		height: 38px;
		border-radius: 8px;
		text-decoration: none !important;
		color: #f8e9f4 !important;
	}

	.inferno-mobile-notif-mount #inferno-notif-btn .inferno-toolbar-count {
		position: absolute;
		bottom: 2px;
		right: 2px;
		font-size: 9px;
		font-weight: 700;
	}

	.inferno-mobile-search-dd,
	.inferno-mobile-menu-dd {
		margin-top: 8px;
		background: linear-gradient(180deg, rgba(12, 12, 16, 0.98), rgba(8, 8, 12, 0.98));
		border: 1px solid rgba(255, 45, 160, 0.4);
		border-radius: 12px;
		box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
		overflow: hidden;
		max-height: min(72vh, 520px);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	/* Account menu: tab strip stays visible; only the list area scrolls. */
	.inferno-mobile-avatar-dd {
		margin-top: 8px;
		background: linear-gradient(180deg, rgba(12, 12, 16, 0.98), rgba(8, 8, 12, 0.98));
		border: 1px solid rgba(255, 45, 160, 0.4);
		border-radius: 12px;
		box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
		max-height: min(72vh, 520px);
		display: flex;
		flex-direction: column;
		overflow: hidden;
		z-index: 3;
		position: relative;
		-webkit-overflow-scrolling: touch;
	}

	.inferno-mobile-avatar-panels {
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.inferno-mobile-avatar-dd[hidden],
	.inferno-mobile-search-dd[hidden],
	.inferno-mobile-menu-dd[hidden] {
		display: none !important;
	}

	.inferno-mobile-menu-scroll {
		padding: 8px;
		max-height: min(70vh, 480px);
		overflow-y: auto;
	}

	.inferno-mobile-menu-scroll .inferno-dd-nav {
		display: flex;
		flex-direction: column;
		gap: 2px;
	}

	.inferno-mobile-market-dd {
		pointer-events: auto;
		display: none;
		margin-top: 8px;
		background: linear-gradient(180deg, rgba(12, 12, 16, 0.98), rgba(8, 8, 12, 0.98));
		border: 1px solid rgba(255, 45, 160, 0.4);
		border-radius: 12px;
		box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
		overflow: hidden;
		padding: 9px;
	}

	.inferno-mobile-market-dd.is-open {
		display: block;
	}

	.inferno-mobile-market-grid {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
	}

	.inferno-mobile-market-grid a {
		display: flex;
		align-items: center;
		gap: 8px;
		padding: 10px 9px;
		color: #fff !important;
		text-decoration: none !important;
		border: 1px solid rgba(255, 255, 255, 0.09);
		border-radius: 9px;
		background: rgba(255, 255, 255, 0.02);
		font-size: 13px !important;
		line-height: 1.25;
	}

	.inferno-mobile-market-grid a i {
		width: 16px;
		text-align: center;
		color: #ff77c7;
	}

	.inferno-mobile-market-grid a:hover {
		background: rgba(255, 45, 160, 0.11);
		border-color: rgba(255, 45, 160, 0.42);
	}

	.inferno-mobile-avatar-tabs {
		display: grid;
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 0;
		border-bottom: 1px solid rgba(255, 255, 255, 0.07);
		background: rgba(28, 26, 32, 0.96);
		position: sticky;
		top: 0;
		z-index: 2;
	}

	.inferno-mobile-avatar-tabs .imtn-tab {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 44px;
		margin: 0;
		padding: 0;
		color: #f8e9f4;
		background: rgba(22, 22, 26, 0.96);
		border: 0;
		border-right: 1px solid rgba(255, 255, 255, 0.07);
		border-bottom: 2px solid transparent;
		cursor: pointer;
		font-size: 16px;
	}

	.inferno-mobile-avatar-tabs .imtn-tab:last-child {
		border-right: 0;
	}

	.inferno-mobile-avatar-tabs .imtn-tab.is-active {
		background: #f2f2f4;
		border-bottom-color: transparent;
		color: #1a1020;
	}

	.inferno-mobile-avatar-tabs .imtn-tab.is-active i {
		color: #1a1020;
	}

	.inferno-mobile-avatar-list a {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 12px 14px;
		color: #fff !important;
		text-decoration: none !important;
		font-size: 18px !important;
		line-height: 1.25;
		border-top: 1px solid rgba(255, 255, 255, 0.05);
	}

	.inferno-mobile-avatar-list a:first-child {
		border-top: 0;
	}

	.inferno-mobile-avatar-list i {
		width: 20px;
		text-align: center;
		color: #a8acb4;
	}

	.inferno-mobile-avatar-list a:hover {
		background: rgba(255, 45, 160, 0.08);
	}

	.inferno-mobile-avatar-list a.imtn-list-js {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 12px 14px;
		color: #fff !important;
		text-decoration: none !important;
		font-size: 18px !important;
		line-height: 1.25;
		border-top: 1px solid rgba(255, 255, 255, 0.05);
		cursor: pointer;
		width: 100%;
		box-sizing: border-box;
		text-align: left;
		background: transparent;
		border-left: 0;
		border-right: 0;
		border-bottom: 0;
		font-family: inherit;
	}

	.inferno-mobile-avatar-list a.imtn-list-js:first-child {
		border-top: 0;
	}

	.inferno-mobile-avatar-list a.imtn-list-js i {
		width: 20px;
		text-align: center;
		color: #a8acb4;
	}

	.inferno-mobile-avatar-list--empty {
		padding: 18px 14px;
	}

	.inferno-mobile-muted {
		color: #a098a8 !important;
		font-size: 15px !important;
	}

	.inferno-mobile-avatar-list[hidden] {
		display: none !important;
	}

	.inferno-mobile-avatar-list--dd .inferno-dd-nav {
		display: flex;
		flex-direction: column;
		gap: 0;
	}

	.inferno-mobile-avatar-list--dd .inferno-dd-item {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 12px 14px;
		color: #fff !important;
		text-decoration: none !important;
		font-size: 16px !important;
		line-height: 1.25;
		border-top: 1px solid rgba(255, 255, 255, 0.05);
	}

	.inferno-mobile-avatar-list--dd .inferno-dd-item:first-child {
		border-top: 0;
	}

	.inferno-mobile-avatar-list--dd .inferno-dd-item-ic {
		width: 22px;
		min-width: 22px;
		text-align: center;
		color: #ff77c7;
	}

	.inferno-mobile-avatar-list--ucp .inferno-dd-section {
		border-top: 1px solid rgba(255, 255, 255, 0.08);
	}

	.inferno-mobile-avatar-list--ucp .inferno-dd-section:first-child {
		border-top: 0;
	}

	.inferno-mobile-avatar-list--ucp .inferno-dd-section-title {
		padding: 10px 14px 4px;
		font-size: 11px;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: 0.06em;
		color: #b8a8c4 !important;
	}

	.inferno-mobile-avatar-list--ucp .inferno-dd-item {
		display: flex;
		align-items: center;
		padding: 11px 14px;
		color: #fff !important;
		font-size: 15px !important;
		text-decoration: none !important;
		border-top: 1px solid rgba(255, 255, 255, 0.04);
	}

	.inferno-notif-panel {
		position: fixed !important;
		left: 8px !important;
		right: 8px !important;
		top: 64px !important;
		width: auto !important;
		max-width: none !important;
	}

	/* Marketplace desktop dropdown compact mobile layout */
	#panel .inferno-toolbar-dd > .inferno-dd-trigger[title="Marketplace"] + .inferno-dd-panel {
		left: auto !important;
		right: 0 !important;
		width: min(96vw, 390px) !important;
		max-width: min(96vw, 390px) !important;
		max-height: 72vh !important;
		overflow: auto !important;
		padding: 8px !important;
		border: 1px solid rgba(255, 45, 160, 0.42) !important;
		border-radius: 12px !important;
		background: linear-gradient(180deg, rgba(20, 12, 28, 0.98), rgba(10, 8, 16, 0.98)) !important;
		box-shadow: 0 14px 34px rgba(0, 0, 0, 0.62) !important;
	}

	#panel .inferno-toolbar-dd > .inferno-dd-trigger[title="Marketplace"] + .inferno-dd-panel .inferno-dd-nav {
		display: grid !important;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
	}

	#panel .inferno-toolbar-dd > .inferno-dd-trigger[title="Marketplace"] + .inferno-dd-panel .inferno-dd-item {
		display: flex !important;
		align-items: center;
		gap: 8px;
		padding: 10px 9px !important;
		border: 1px solid rgba(255, 255, 255, 0.09) !important;
		border-radius: 9px !important;
		background: rgba(255, 255, 255, 0.02) !important;
		color: #f5e9f4 !important;
		font-size: 13px !important;
		line-height: 1.25 !important;
		min-height: 44px;
	}

	#panel .inferno-toolbar-dd > .inferno-dd-trigger[title="Marketplace"] + .inferno-dd-panel .inferno-dd-item:hover {
		background: rgba(255, 45, 160, 0.11) !important;
		border-color: rgba(255, 45, 160, 0.42) !important;
	}

	#panel .inferno-toolbar-dd > .inferno-dd-trigger[title="Marketplace"] + .inferno-dd-panel .inferno-dd-item-ic {
		width: 18px;
		min-width: 18px;
		display: inline-flex;
		justify-content: center;
		color: #ff77c7;
	}

	#panel .inferno-toolbar-dd > .inferno-dd-trigger[title="Marketplace"] + .inferno-dd-panel .inferno-dd-item-tx {
		white-space: normal !important;
		word-break: break-word;
	}

	.inferno-dd-panel {
		left: 0 !important;
		right: auto !important;
		max-width: min(94vw, 340px) !important;
	}

	input[type="text"],
	input[type="email"],
	input[type="password"],
	input[type="number"],
	select,
	textarea {
		font-size: 16px !important;
		max-width: 100% !important;
	}

	/* Composer: theme locks textarea to 40px tall while mobile forces 16px — text/placeholder clip. Slightly taller box + smaller placeholder. */
	#inferno-convo .inferno-convo-input,
	html.inferno-convo-embed #inferno-convo .inferno-convo-input {
		min-height: 44px !important;
		height: 44px !important;
		max-height: 120px !important;
		padding: 8px 10px !important;
		line-height: 1.25 !important;
		font-size: 16px !important;
		box-sizing: border-box !important;
	}

	#inferno-convo .inferno-convo-input::placeholder,
	html.inferno-convo-embed #inferno-convo .inferno-convo-input::placeholder {
		font-size: 13px !important;
		line-height: 1.3 !important;
	}

	.pagination,
	.multipage {
		display: flex;
		flex-wrap: wrap;
		gap: 6px;
	}

	/* Floating widgets safe-area corrections */
	.inferno-convo-widget {
		right: max(12px, env(safe-area-inset-right)) !important;
		bottom: calc(env(safe-area-inset-bottom, 0px) + 26px) !important;
	}

	/*
	 * IMPORTANT: only style the panel when open. Unconditional display:flex !important here
	 * overrides theme display:none and the sheet stays visible — close appears “broken” on mobile.
	 */
	.inferno-convo-widget[data-open="1"] {
		z-index: 13000 !important;
	}

	.inferno-convo-widget[data-open="1"] .inferno-convo-widget-panel {
		position: fixed !important;
		left: 8px !important;
		right: 8px !important;
		top: auto !important;
		/* Bottom sheet above FAB + safe area (panel was full-bleed from header, felt “stuck” under topnav). */
		bottom: calc(env(safe-area-inset-bottom, 0px) + 58px) !important;
		width: auto !important;
		max-width: none !important;
		height: min(82dvh, 720px) !important;
		max-height: min(82dvh, 720px) !important;
		display: flex !important;
		flex-direction: column !important;
		overflow: hidden !important;
	}

	.inferno-convo-widget[data-open="0"] .inferno-convo-widget-panel {
		display: none !important;
	}

	.inferno-convo-widget-head {
		position: relative;
		z-index: 2;
		flex: 0 0 auto;
	}

	.inferno-convo-widget-close {
		min-width: 44px;
		min-height: 44px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		touch-action: manipulation;
		-webkit-tap-highlight-color: transparent;
	}

	.inferno-convo-widget-frame {
		width: 100% !important;
		flex: 1 1 auto !important;
		min-height: 0 !important;
		height: auto !important;
		border: 0 !important;
	}

	/* Embedded chat document: keep viewport fill inside the widget iframe (see html/body :not(.inferno-convo-embed) above). */
	html.inferno-convo-embed,
	body.inferno-convo-embed {
		height: 100% !important;
		margin: 0 !important;
		overflow: hidden !important;
		box-sizing: border-box !important;
	}

	#inferno-convo.inferno-convo--embed {
		height: 100% !important;
		max-height: 100% !important;
		min-height: 0 !important;
	}

	/* Embedded chat internals: full overlay drawer and stable scroll */
	html.inferno-convo-embed #inferno-convo.inferno-convo--embed .inferno-convo-embed-shell {
		position: relative !important;
		overflow: hidden !important;
		flex: 1 1 auto !important;
		min-height: 0 !important;
	}

	html.inferno-convo-embed #inferno-convo.inferno-convo--embed .inferno-convo-embed-sidebar {
		width: 100% !important;
		max-width: none !important;
		right: 0 !important;
		z-index: 60 !important;
		pointer-events: none !important;
		transform: translateX(-105%) !important;
	}

	html.inferno-convo-embed.inferno-convo-embed-sidebar-open #inferno-convo.inferno-convo--embed .inferno-convo-embed-sidebar {
		pointer-events: auto !important;
		transform: translateX(0) !important;
	}

	html.inferno-convo-embed #inferno-convo.inferno-convo--embed .inferno-convo-embed-side-scroll {
		overflow-y: auto !important;
		overflow-x: hidden !important;
	}

	/* UserCP/PM mobile drawer (single source). */
	body.inferno-usercp .inferno-ucp-layout-table,
	body.inferno-usercp .inferno-ucp-layout-table > tbody,
	body.inferno-usercp .inferno-ucp-layout-table > tbody > tr {
		display: block !important;
		width: 100% !important;
	}

	body.inferno-usercp .inferno-ucp-nav-cell,
	body.inferno-usercp .inferno-ucp-nav-source {
		display: none !important;
		width: 0 !important;
		min-width: 0 !important;
		max-width: 0 !important;
		padding: 0 !important;
		border: 0 !important;
		overflow: hidden !important;
	}

	body.inferno-usercp #content .navigation:has(a.usercp_nav_item),
	body.inferno-usercp #content td:has(a.usercp_nav_item) {
		display: none !important;
		width: 0 !important;
		min-width: 0 !important;
		max-width: 0 !important;
		padding: 0 !important;
		border: 0 !important;
		overflow: hidden !important;
	}

	body.inferno-usercp .inferno-ucp-nav-drawer {
		position: fixed !important;
		left: 0;
		top: 0;
		height: 100vh;
		max-height: 100vh;
		width: min(86vw, 340px) !important;
		max-width: 340px !important;
		z-index: 11000;
		overflow: auto;
		transform: translateX(-104%);
		transition: transform 0.22s ease;
		box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
		background: rgba(12, 8, 18, 0.98) !important;
		padding: 6px 0 16px;
	}

	body.inferno-usercp.inferno-ucp-nav-open .inferno-ucp-nav-drawer {
		transform: translateX(0);
	}

	body.inferno-usercp .inferno-ucp-main-cell {
		width: 100% !important;
		display: block !important;
	}

	body.inferno-usercp .inferno-ucp-nav-overlay {
		display: none;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.55);
		z-index: 10950;
	}

	body.inferno-usercp.inferno-ucp-nav-open .inferno-ucp-nav-overlay {
		display: block;
	}

	body.inferno-usercp .inferno-ucp-nav-toggle {
		position: fixed;
		left: max(10px, env(safe-area-inset-left));
		bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
		z-index: 11100;
		display: inline-flex;
		align-items: center;
		gap: 8px;
		padding: 9px 12px;
		border: 1px solid rgba(255, 120, 190, 0.58);
		border-radius: 10px;
		background: linear-gradient(180deg, rgba(210, 70, 150, 0.95), rgba(98, 30, 80, 0.98));
		color: #fff;
		font-weight: 800;
		font-size: 12px;
		letter-spacing: 0.03em;
		cursor: pointer;
		box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
	}

	body.inferno-usercp .inferno-ucp-nav-toggle i {
		font-size: 12px;
	}
}

#copyright {
	font-size: 12px;
}

@media (max-width: 980px) {
	#copyright {
		margin-bottom: 0 !important;
		padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
	}
}

/* Footer quick links (Inferno patch replaces ul.bottom_links) */
#footer ul.inferno-footer-bottom-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 10px;
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
}

#footer ul.inferno-footer-bottom-links li {
	margin: 0;
	padding: 0;
}

#footer ul.inferno-footer-bottom-links a {
	display: inline-flex;
	align-items: center;
	padding: 6px 12px;
	border-radius: 999px;
	border: 1px solid rgba(255, 45, 160, 0.35);
	background: rgba(255, 45, 160, 0.08);
	font-size: 13px;
	font-weight: 700;
	text-decoration: none !important;
	line-height: 1.2;
}

#footer ul.inferno-footer-bottom-links a:hover,
#footer ul.inferno-footer-bottom-links a:active {
	border-color: rgba(255, 45, 160, 0.55);
	background: rgba(255, 45, 160, 0.14);
}

/* Current time first, welcome / guest row second — space-between keeps time left, welcome right on desktop */
#panel .upper .inferno-welcome-time-row {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px 16px;
	flex: 1 1 auto;
	min-width: 0;
}

#panel .upper .inferno-welcome-time-row .welcome {
	flex: 1 1 auto;
	min-width: 0;
	text-align: right;
}

#panel .upper .inferno-welcome-time-row--guest .inferno-guest-upper-row {
	flex: 0 1 auto;
	min-width: 0;
}

#panel .upper .inferno-header-current-time {
	flex: 0 1 auto;
	margin-left: 0;
	text-align: left;
	font-size: 12px;
	line-height: 1.35;
	color: rgba(230, 220, 240, 0.88);
	white-space: normal;
	max-width: 100%;
}

#panel .upper .inferno-header-current-time strong {
	font-weight: 800;
	color: rgba(248, 244, 255, 0.94);
}

@media (max-width: 980px) {
	#panel .upper .inferno-header-current-time {
		flex: 1 1 100%;
		margin-left: 0;
		text-align: left;
		font-size: 11px;
	}

	#panel .upper .inferno-welcome-time-row .welcome {
		text-align: left;
		flex: 1 1 100%;
	}
}

/*
 * Personal Notepad — ≤550px (EOF). Use .inferno-ucp-notepad-wrap in :has() — #notepad may change when SCEditor loads.
 * Do not use display:flex on <form>: the inner table becomes a flex item (min-width:auto) and overflows the viewport.
 */
@media (max-width: 550px) {
	body.inferno-usercp #content td:has(.inferno-ucp-notepad-wrap) {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) table.tborder {
		display: table !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		table-layout: fixed !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-wrap {
		display: block !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-actions {
		display: flex !important;
		flex-direction: column !important;
		align-items: stretch !important;
		justify-content: flex-start !important;
		gap: 10px !important;
		clear: both !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
		margin: 0 !important;
		padding: 12px 0 16px !important;
		text-align: unset !important;
	}

	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-actions input.button,
	body.inferno-usercp #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-actions input[type="submit"] {
		display: block !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
		margin: 0 !important;
		padding: 12px 14px !important;
		font-size: 16px !important;
		line-height: 1.25 !important;
		text-align: center !important;
	}

	body.inferno-usercp:has(#inferno-convo-widget-btn) #content form:has(.inferno-ucp-notepad-wrap) .inferno-ucp-notepad-actions {
		padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
	}
}

/*
 * usercp.php?action=options — two 50% columns become one card per row (avoids right-edge clipping on phones).
 * Scoped by the update form’s hidden input action=do_options (MyBB usercp_options template).
 */
@media (max-width: 980px) {
	body.inferno-usercp #content form:has(input[name="action"][value="do_options"]) table.tborder {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(input[name="action"][value="do_options"]) table.tborder > tbody {
		display: block !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(input[name="action"][value="do_options"]) table.tborder > tbody > tr:first-child {
		display: block !important;
		width: 100% !important;
	}

	body.inferno-usercp #content form:has(input[name="action"][value="do_options"]) table.tborder > tbody > tr:first-child > td {
		display: block !important;
		width: 100% !important;
		max-width: 100% !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(input[name="action"][value="do_options"]) table.tborder > tbody > tr:nth-child(2) {
		display: flex !important;
		flex-direction: column !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
	}

	body.inferno-usercp #content form:has(input[name="action"][value="do_options"]) table.tborder > tbody > tr:nth-child(2) > td {
		display: block !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		flex: none !important;
		box-sizing: border-box !important;
	}
}

/*
 * UserCP home: "Your Latest Threads" — hide Views + Last Post on small screens.
 * Scoped by search.php?action=finduserthreads link (MyBB default template).
 */
@media (max-width: 768px) {
	body.inferno-usercp #content table.tborder:has(> tbody > tr:first-child a[href*="finduserthreads"]) > tbody > tr:nth-child(2) > td:nth-child(3),
	body.inferno-usercp #content table.tborder:has(> tbody > tr:first-child a[href*="finduserthreads"]) > tbody > tr:nth-child(2) > td:nth-child(4),
	body.inferno-usercp #content table.tborder:has(> tbody > tr:first-child a[href*="finduserthreads"]) > tbody > tr:nth-child(n + 3) > td:nth-child(5),
	body.inferno-usercp #content table.tborder:has(> tbody > tr:first-child a[href*="finduserthreads"]) > tbody > tr:nth-child(n + 3) > td:nth-child(6) {
		display: none !important;
	}
}
