/* ==========================================================================
   modern58 — responsive modernization layer for 58.ca (Discuz! X5.0)
   Loaded after rentianji.css; overrides the fixed 1200px desktop layout
   with a fluid, mobile-first design system.
   ========================================================================== */

:root {
	--m58-maxw: min(100% - 16px, 1830px);  /* page width: near-full browser width */
	--m58-primary: #e4393c;          /* 58.ca brand red */
	--m58-primary-dark: #c62f32;
	--m58-primary-soft: #fdecec;
	--m58-accent: #ff7a45;
	--m58-text: #1f2329;
	--m58-text-2: #5f6672;
	--m58-text-3: #9aa1ac;
	--m58-bg: #f5f6f8;
	--m58-surface: #ffffff;
	--m58-border: #e7e9ee;
	--m58-radius: 12px;
	--m58-radius-sm: 8px;
	--m58-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
	--m58-shadow-lg: 0 8px 24px rgba(16, 24, 40, .12);
	--m58-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		"PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
		"Helvetica Neue", Arial, sans-serif;
}

/* ---------- base ---------- */

html { -webkit-text-size-adjust: 100%; }

body {
	font-family: var(--m58-font) !important;
	font-size: 14px;
	line-height: 1.6;
	color: var(--m58-text);
	background: var(--m58-bg) !important;
}

a { transition: color .15s ease; }
a:hover { color: var(--m58-primary); text-decoration: none; }

img { max-width: 100%; height: auto; }

::selection { background: var(--m58-primary); color: #fff; }

/* ---------- fluid containers: kill the fixed 1200px grid ---------- */

.w-1200,
.wp,
#ft,
.ren-footer-box,
.ren-header-centre {
	width: auto !important;
	max-width: var(--m58-maxw) !important;
	margin-left: auto !important;
	margin-right: auto !important;
	padding-left: 16px;
	padding-right: 16px;
	box-sizing: border-box;
}

.min-1200 { min-width: 0 !important; }
.mw-100 { min-width: 0 !important; }

/* nested containers shouldn't double-pad */
.w-1200 .w-1200 { padding-left: 0; padding-right: 0; }

/* ---------- header / navigation ---------- */

.ren-header-nav,
#fixed-header-wrap {
	background: var(--m58-surface) !important;
	box-shadow: var(--m58-shadow);
}

#hd.ren-header-nav { border-bottom: 1px solid var(--m58-border); }

.navbar {
	position: sticky;
	top: 0;
	z-index: 200;
	background: var(--m58-surface);
	border-bottom: 1px solid var(--m58-border);
}

.navbar-nav {
	display: flex !important;
	flex-wrap: nowrap;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	margin: 0 auto;
	max-width: var(--m58-maxw);
	padding: 0 8px;
}
.navbar-nav::-webkit-scrollbar { display: none; }

.navbar-nav li { float: none !important; flex: 0 0 auto; }

.navbar-nav li a {
	display: block;
	padding: 12px 18px !important;
	font-size: 15px;
	font-weight: 500;
	color: var(--m58-text) !important;
	background: none !important;
	border-radius: 0;
	position: relative;
}

.navbar-nav li a:hover { color: var(--m58-primary) !important; }

.navbar-nav li.a a {
	color: var(--m58-primary) !important;
	font-weight: 600;
}
.navbar-nav li.a a::after {
	content: "";
	position: absolute;
	left: 18px; right: 18px; bottom: 0;
	height: 3px;
	border-radius: 3px 3px 0 0;
	background: var(--m58-primary);
}

/* search box */
.rtj1009-sousuo input[type="text"],
.rtj1009-sousuo .px,
#scbar_txt {
	border: 1.5px solid var(--m58-border) !important;
	border-radius: 999px !important;
	background: var(--m58-bg) !important;
	padding: 8px 16px !important;
	height: auto !important;
	transition: border-color .15s ease, background .15s ease;
}
.rtj1009-sousuo input[type="text"]:focus,
#scbar_txt:focus {
	border-color: var(--m58-primary) !important;
	background: #fff !important;
	outline: none;
}

/* post button */
.ren-nav-postbtn a,
.btn-primary {
	background: var(--m58-primary) !important;
	border: none !important;
	border-radius: 999px !important;
	box-shadow: 0 2px 6px rgba(228, 57, 60, .3);
	transition: background .15s ease, transform .1s ease;
}
.ren-nav-postbtn a:hover,
.btn-primary:hover {
	background: var(--m58-primary-dark) !important;
	transform: translateY(-1px);
}

/* ---------- cards & content blocks ---------- */

.ren-common-row,
.ren-card,
.bg-white,
.area .bg-white {
	border-radius: var(--m58-radius);
}

.ren-common-row {
	background: var(--m58-surface) !important;
	box-shadow: var(--m58-shadow);
	border: 1px solid var(--m58-border);
	overflow: hidden;
}

.ren-card {
	border-bottom: 1px solid var(--m58-border) !important;
	padding-bottom: 10px;
}
.ren-card .font-24, .ren-card h2, .ren-card h3 {
	font-weight: 600;
	color: var(--m58-text);
}

/* list rows hover */
.ren-common-left li:hover,
.ren-common-right li:hover { background: var(--m58-bg); border-radius: var(--m58-radius-sm); }

/* forum tables (bm/fl classic Discuz blocks) */
.bm, .fl {
	border: 1px solid var(--m58-border) !important;
	border-radius: var(--m58-radius);
	overflow: hidden;
	box-shadow: var(--m58-shadow);
	background: var(--m58-surface);
}
.bm_h, .bm_c { border-color: var(--m58-border) !important; }
th, td { border-color: var(--m58-border) !important; }

/* thread list readability */
.tl th, .tl td { padding-top: 10px; padding-bottom: 10px; }
.tl .s.xst { font-size: 15px; }

/* pagination */
.pg a, .pg strong, .pgb a, .pg label {
	border: 1px solid var(--m58-border) !important;
	border-radius: var(--m58-radius-sm) !important;
	background: var(--m58-surface) !important;
	margin: 0 3px;
	transition: all .15s ease;
}
.pg a:hover { border-color: var(--m58-primary) !important; color: var(--m58-primary) !important; }
.pg strong {
	background: var(--m58-primary) !important;
	border-color: var(--m58-primary) !important;
	color: #fff !important;
}

/* buttons (Discuz classic) */
.pn {
	border-radius: var(--m58-radius-sm) !important;
	border: 1px solid var(--m58-border) !important;
	transition: all .15s ease;
}
.pn.pnc {
	background: var(--m58-primary) !important;
	border-color: var(--m58-primary) !important;
}
.pn.pnc:hover { background: var(--m58-primary-dark) !important; }

/* forms */
input.px, textarea.pt, select.ps {
	border: 1.5px solid var(--m58-border) !important;
	border-radius: var(--m58-radius-sm) !important;
	transition: border-color .15s ease;
}
input.px:focus, textarea.pt:focus { border-color: var(--m58-primary) !important; }

/* avatars */
.avatar img, .avt img { border-radius: 50%; }

/* ---------- footer ---------- */

.ren-footer {
	background: #23272f !important;
	margin-top: 32px;
	padding: 32px 0 16px;
}
.ren-footer-in {
	display: flex !important;
	flex-wrap: wrap;
	gap: 24px 48px;
	float: none !important;
}
.ren-footer-in dl { float: none !important; margin: 0; min-width: 140px; }
.ren-footer-in dt { color: #fff; font-weight: 600; margin-bottom: 10px; }
.ren-footer-in dd a { color: #9aa1ac; }
.ren-footer-in dd a:hover { color: #fff; }
.ren-footer-bottom {
	background: #1b1e24 !important;
	color: #9aa1ac;
}
.ren-footer-bottom a { color: #9aa1ac; }
.ren-footer-bottom a:hover { color: #fff; }

/* ---------- floating tools ---------- */

#scrolltop span a, #scrolltop .returnlist, #scrolltop .returnboard {
	border-radius: var(--m58-radius-sm);
	box-shadow: var(--m58-shadow);
}

/* ---------- mobile nav toggle (injected by modern.js) ---------- */

.m58-menu-btn {
	display: none;
	background: none;
	border: none;
	padding: 10px 14px;
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
	color: var(--m58-text);
}

/* ==========================================================================
   Responsive retrofit
   ========================================================================== */

@media (max-width: 1240px) {
	.w-1200, .wp { max-width: 100% !important; }
}

@media (max-width: 992px) {
	/* two-column portal layout stacks */
	.ren-common-left, .ren-common-right {
		float: none !important;
		width: 100% !important;
		margin: 0 0 16px !important;
	}
	/* forum page side column */
	#ct .sd, .fl .fl_g { width: auto; }
	/* hide heavyweight desktop-only ad rails */
	.a_fl, .a_fr, .a_cb { display: none !important; }
}

@media (max-width: 768px) {
	body { font-size: 15px; }

	/* header condenses */
	.ren-header-centre h3 { max-width: 140px; overflow: hidden; }
	.rtj1009-sousuo { width: 100% !important; margin-top: 8px; }
	.ren-nav-postbtn { display: none !important; }
	.ren-header-userstatus { float: right !important; }

	/* generic float un-stick for stacked layouts inside content areas */
	#ct .z, #ct .y,
	.ren-common-diy .z, .ren-common-diy .y {
		float: none !important;
	}
	.ren-common-diy img { width: 100%; }

	/* index channel blocks become single column cards */
	.ren-index-row-san > div, .ren-index-row-wu > div {
		width: 100% !important;
		float: none !important;
		margin: 0 0 12px !important;
	}

	/* thread lists: hide secondary columns */
	.tl .by, .tl .num, th.by, th.num { display: none !important; }
	.tl th, .tl td { display: block; width: auto !important; }
	.tl tr { display: block; border-bottom: 1px solid var(--m58-border); padding: 8px 0; }

	/* post page */
	#postlist .pls { width: 100% !important; float: none !important; display: block; }
	#postlist .plc { display: block; margin-left: 0 !important; }
	.pls .avatar { float: left; margin-right: 10px; }

	/* footer stacks */
	.ren-footer-in { flex-direction: column; gap: 16px; }
	.ren-footer-y { float: none !important; }

	/* hide desktop floaters on touch */
	#scrolltop .ren-scrol-qq, #scrolltop .ren-scrol-weixin { display: none; }
}

@media (max-width: 480px) {
	.w-1200, .wp { padding-left: 12px; padding-right: 12px; }
	.navbar-nav li a { padding: 10px 12px !important; font-size: 14px; }
}

/* ---------- mobile nav drawer ---------- */

@media (max-width: 768px) {
	.m58-menu-btn { display: block; }
	.navbar { display: flex; align-items: center; }
	.navbar .navbar-collapse { flex: 1; min-width: 0; }
	.navbar.m58-open .navbar-nav {
		display: block !important;
		position: absolute;
		left: 0; right: 0; top: 100%;
		background: var(--m58-surface);
		border-bottom: 1px solid var(--m58-border);
		box-shadow: var(--m58-shadow-lg);
		max-height: 70vh;
		overflow-y: auto;
		padding: 6px 0;
		z-index: 300;
	}
	.navbar.m58-open .navbar-nav li a {
		padding: 12px 20px !important;
		border-bottom: 1px solid var(--m58-border);
	}
	.navbar.m58-open .navbar-nav li.a a::after { display: none; }
	.navbar.m58-open .navbar-nav li.a a { background: var(--m58-primary-soft) !important; }
}

/* ==========================================================================
   Homepage (portal/index) responsive retrofit
   Fixed-width blocks defined in extend_common.css become fluid.
   ========================================================================== */

/* desktop polish */
.ren-index-rowe .ren-slider,
.ren-index-right-yi,
.ren-index-right-e,
.ren-index-left-menu { border-radius: var(--m58-radius); overflow: hidden; }

@media (max-width: 1240px) {
	/* hero: menu (300) + slider (560) + right rail (320) can't fit — drop menu */
	.ren-index-left-menu { display: none; }
	.ren-left-none .ren-index-rowe,
	.ren-index-rowe { width: calc(100% - 340px) !important; }
	.ren-index-rowe .ren-slider { width: 100% !important; }
}

@media (max-width: 992px) {
	/* hero stacks: slider full width, right rail below */
	.ren-index-rowe,
	.ren-left-none .ren-index-rowe { width: 100% !important; float: none !important; }
	.ren-index-rowe .ren-slider,
	.ren-index-rowe .flexslider,
	.ren-index-rowe .slides li { height: auto !important; min-height: 200px; }
	.ren-index-rowe .slides img { width: 100%; height: auto; }
	.ren-index-rowsan,
	.ren-index-rowsan .ren-index-right-info,
	.ren-index-rowsan .ren-index-right-yi,
	.ren-index-rowsan .ren-index-right-fix { width: 100% !important; float: none !important; }
	.ren-index-rowsan { margin-top: 16px; }
	.ren-index-rowsan .ren-slider { width: 100% !important; height: auto !important; }

	/* channel rows: slider + link columns reflow */
	.rc-e8-ndiy, .rc-e8-ndiy .ren-slider { width: 100% !important; height: auto !important; }
	.ren-common-left-e { width: 100% !important; float: none !important; margin-top: 12px; }
}

@media (max-width: 768px) {
	/* headline link lists become full-width rows */
	.rc-e3-ndiy li, .rc-e3-ndiy li a { width: 100% !important; box-sizing: border-box; }

	/* image grids become fluid 2-up / 3-up */
	.rc-e10-ndiy ul, .rc-e12-ndiy ul {
		display: grid !important;
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
		gap: 10px;
	}
	.rc-e10-ndiy li, .rc-e12-ndiy li {
		width: auto !important; height: auto !important;
		float: none !important; margin: 0 !important;
		border-radius: var(--m58-radius-sm); overflow: hidden;
	}
	.rc-e10-ndiy li img, .rc-e12-ndiy li img {
		width: 100% !important; height: auto !important;
		aspect-ratio: 4 / 3; object-fit: cover;
	}

	/* section headers scale down */
	.ren-card .font-24 { font-size: 18px !important; }

	/* top notice strips / secondary hero rows */
	.rtj1009-iho-0, .rtj1009-iho-1, .rtj1009-iho-2, .rtj1009-iho-3 { overflow-x: auto; }
	.rtj1009-iho-0 img, .rtj1009-iho-1 img, .rtj1009-iho-2 img, .rtj1009-iho-3 img { max-width: 100%; height: auto; }
}

/* ==========================================================================
   Forum pages (forumdisplay / viewthread) responsive retrofit
   ========================================================================== */

/* desktop polish: post cards */
#postlist > div { border-radius: var(--m58-radius); overflow: hidden; margin-bottom: 12px; }
.plh .ts, #thread_subject { font-size: 20px; line-height: 1.4; font-weight: 600; }
.t_f { font-size: 15px; line-height: 1.8; }
.t_f img { border-radius: var(--m58-radius-sm); }

@media (max-width: 992px) {
	/* main + sidebar stack */
	#ct .mn { width: 100% !important; float: none !important; }
	#ct .sd, .ren-sd-diy-san { width: 100% !important; float: none !important; margin: 16px 0 0 !important; }
	.ren-sd-diy-san .rc-e2-ndiy img, .ren-sd-diy-san .rc-e2-ndiy span,
	.ren-sd-diy-san .rc-e3-ndiy li, .ren-sd-diy-san .rc-e3-ndiy li a { width: 100% !important; height: auto !important; }
}

@media (max-width: 768px) {
	/* author column collapses into a horizontal byline */
	#postlist .pls {
		width: 100% !important; float: none !important;
		display: flex; align-items: center; gap: 10px;
		padding: 10px 12px !important;
		border-bottom: 1px solid var(--m58-border);
		background: var(--m58-surface) !important;
	}
	#postlist .pls .avatar { margin: 0; }
	#postlist .pls .avatar img { width: 40px !important; height: 40px !important; }
	#postlist .pls .tns, #postlist .pls .xg1,
	#postlist .pls .pil, #postlist .pls .p_pofl { display: none; }
	#postlist .plc { margin-left: 0 !important; display: block; }

	/* thread content: never overflow */
	.t_f, .pcb { word-break: break-word; overflow-wrap: anywhere; }
	.t_f table { display: block; overflow-x: auto; }

	/* reply editor */
	#fastpostform .pls { display: none !important; }
	#fastpostform .plc { margin: 0 !important; }

	/* breadcrumbs wrap */
	#pt .z { float: none; }
	#pt { white-space: normal; line-height: 1.8; }

	/* forumdisplay filter bar scrolls horizontally */
	#filter_special_menu, .tf, .th_f { overflow-x: auto; }
}

/* ==========================================================================
   Auth pages (login / register) + search + accessibility
   ========================================================================== */

.m58-auth-wrap { padding: 60px 16px !important; }

.m58-auth-card {
	width: 100% !important;
	max-width: 430px;
	background: var(--m58-surface);
	border: 1px solid var(--m58-border);
	border-radius: var(--m58-radius);
	box-shadow: var(--m58-shadow-lg);
	padding: 28px 28px 20px;
	box-sizing: border-box;
}
.m58-auth-card-wide { max-width: 720px; }

.ren-login .rfm td input, .ren-login .rfm td select {
	border-radius: var(--m58-radius-sm) !important;
}

@media (max-width: 768px) {
	.m58-auth-wrap { padding: 24px 12px !important; }
	.m58-auth-card { padding: 20px 16px 14px; }
	.ren-login .rfm { min-width: 0 !important; }
	.ren-login .rfm th { min-width: 56px; }
}

/* search results */
.slst ul li, .xs3 { line-height: 1.5; }
.slst { word-break: break-word; }
@media (max-width: 768px) {
	.slst ul li { padding: 10px 4px; }
	#scform_tb, .sttl { overflow-x: auto; }
}

/* ---------- accessibility ---------- */

a:focus-visible, button:focus-visible, input:focus-visible,
.m58-menu-btn:focus-visible {
	outline: 2px solid var(--m58-primary);
	outline-offset: 2px;
	border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ==========================================================================
   News article pages (portal view) — readability
   ========================================================================== */

.ren-article-view h1#thread_subject,
.ren-article-view h1 {
	font-size: 26px;
	line-height: 1.35;
	font-weight: 700;
	text-wrap: balance;
}

#article_content {
	font-size: 17px !important;
	line-height: 1.85;
	color: var(--m58-text);
	word-break: break-word;
	overflow-wrap: anywhere;
}
#article_content p { margin: 0 0 1em; }
#article_content img {
	max-width: 100% !important;
	height: auto !important;
	border-radius: var(--m58-radius-sm);
	display: block;
	margin: 12px auto;
}
#article_content table { display: block; max-width: 100%; overflow-x: auto; }
#article_content iframe, #article_content video { max-width: 100%; }

/* byline / meta strip */
.ren-article-view .xg1 { color: var(--m58-text-3); font-size: 13px; }

/* comfortable reading measure on wide screens */
@media (min-width: 992px) {
	.ren-article-view .vwtb { max-width: 860px; margin: 0 auto; }
}

@media (max-width: 768px) {
	.ren-article-view h1 { font-size: 21px; }
	#article_content { font-size: 16px !important; }
	.ren-article-category { overflow-x: auto; }
}

/* ==========================================================================
   Inline fixed-width clamp (audit pass)
   Many legacy templates carry style="width: NNNpx". Cap them at the
   container width instead of editing every template.
   ========================================================================== */

div[style*="width"], span[style*="width"], p[style*="width"],
textarea[style*="width"], input[style*="width"], form[style*="width"],
a[style*="width"], img[style*="width"], table[style*="width"] {
	max-width: 100% !important;
	box-sizing: border-box;
}

/* paired homepage ad banners (inline width: 590px) stay side-by-side fluidly */
.wp a.z[style*="width: 590px"], .wp a.y[style*="width: 590px"] {
	width: 49.2% !important;
}
@media (max-width: 768px) {
	.wp a.z[style*="width: 590px"], .wp a.y[style*="width: 590px"] {
		width: 100% !important;
		float: none !important;
		display: block;
		margin-bottom: 8px;
	}
}

/* user-space control panels: fluid editors and DIY dialogs */
.diywin { width: auto !important; }
textarea.pt, input.px { max-width: 100%; }
@media (max-width: 768px) {
	.exfm, .diywin { width: 100% !important; }
	.appl { width: 100% !important; float: none !important; }  /* home sidebar */
	.tbmu, .ptm { overflow-x: auto; }
}

/* group page right column */
@media (max-width: 992px) {
	.group-wrap .y[style*="width"] { width: 100% !important; float: none !important; }
}

/* ==========================================================================
   Kill the legacy 1500px master grid (extend_common.css)
   ========================================================================== */

#nv_misc.pg_mobile #wp,
#darkroomtable,
#fixed-header,
#nv.navbar .navbar-collapse,
.ren-nav-bg .ren-header-nav #nv.navbar,
.ren-navsub-menu1, .ren-navsub-menu2, .ren-navsub-menu3,
.nav-wu .bg-se .ren-navsub-menu3, .nav-si .bg-se .ren-navsub-menu2,
#pt {
	width: auto !important;
	max-width: var(--m58-maxw) !important;
	margin-left: auto !important;
	margin-right: auto !important;
}

#nv.navbar,
.pg_logging, .pg_logging .wp, .pg_register .wp {
	min-width: 0 !important;
}

#pt { height: auto !important; min-height: 46px; }

/* ==========================================================================
   User space (home/) polish
   ========================================================================== */

/* profile header + tab bars */
#uhd {
	border-radius: var(--m58-radius);
	border: 1px solid var(--m58-border);
	background: var(--m58-surface);
	box-shadow: var(--m58-shadow);
	overflow: hidden;
}
#uhd .tb, .tb.cl {
	border-bottom: 1px solid var(--m58-border);
}
.tb .a a {
	color: var(--m58-primary) !important;
	border-bottom: 2px solid var(--m58-primary);
	background: none !important;
	font-weight: 600;
}

/* friend / member cards */
.buddy, .ml li {
	border-radius: var(--m58-radius-sm);
	transition: background .15s ease;
}
.buddy:hover, .ml li:hover { background: var(--m58-bg); }

@media (max-width: 768px) {
	/* space two-column layout stacks */
	#ct .appl + .tbn, .tbn { width: 100% !important; float: none !important; }
	#uhd .mt { display: block; }
	.ml li { width: 46% !important; }
	.tb li { float: left; }
	.tb { overflow-x: auto; white-space: nowrap; }
}

/* ==========================================================================
   Portal list pages (news categories) + group/tag + post editor
   ========================================================================== */

/* list layout: main column + right rail become fluid */
.ren-main-mn.ren-main-left,
.ren-list-right-g .ren-main-left,
.ren-forumdisplay .ren-list-right-k .ren-main-left,
.ren-article-wrap .ren-main-left {
	width: calc(100% - 340px) !important;
}
.ren-article-wrap .ren-main-left { width: calc(100% - 340px) !important; }
@media (max-width: 992px) {
	.ren-article-wrap .ren-main-left { width: 100% !important; float: none !important; }
}

/* article list rows read as cards */
.ren-cat-list-li, .rc-e15-ng {
	border-radius: var(--m58-radius-sm);
	transition: background .15s ease;
}
.ren-cat-list-li:hover { background: var(--m58-bg); }

@media (max-width: 992px) {
	.ren-main-mn.ren-main-left,
	.ren-list-right-g .ren-main-left,
	.ren-forumdisplay .ren-list-right-k .ren-main-left {
		width: 100% !important; float: none !important;
	}
	.ren-main-right,
	.ren-viewthread .ren-main-right,
	.ren-main-right .ren-index-right-yi,
	.ren-index-main .ren-main-right .ren-index-right-yi {
		width: 100% !important; float: none !important; margin-top: 16px;
	}
	.ren-viewthread .ren-main-right .rc-e2-ndiy a img,
	.ren-viewthread .ren-main-right .rc-e2-ndiy a span { width: 100% !important; height: auto !important; }
	.ren-about-index .ren-cat-list-li .rc-e17-ng { width: 100% !important; }
}

@media (max-width: 768px) {
	/* list row: thumbnail scales, text wraps */
	.ren-cat-list-li img, .rc-e15-ng img { max-width: 40%; height: auto !important; }
	.rc-e16-ng, .rc-e17-ng { width: 100% !important; float: none !important; }
}

/* group index right column + tag cloud */
@media (max-width: 992px) {
	#group_index .y[style], .group_r { width: 100% !important; float: none !important; }
	.tagcloudtop { line-height: 2.2; word-break: break-word; }
}

/* post/reply editor page */
@media (max-width: 768px) {
	#postbox, .pbox { width: auto !important; }
	#e_controls, .edt .bar { overflow-x: auto; white-space: nowrap; }
	#e_textarea, .area textarea.pt { width: 100% !important; box-sizing: border-box; }
	.exfm th { width: auto !important; }
	#post_extra_c .exfm, .psth { overflow-x: auto; }
}

/* ==========================================================================
   Main nav — out-specify the legacy #nv.navbar blue-block rules
   ========================================================================== */

#nv.navbar {
	background: var(--m58-surface) !important;
	height: auto !important;
	border-bottom: 1px solid var(--m58-border);
	overflow: visible !important;
	position: sticky;
	top: 0;
	z-index: 200;
}
#nv.navbar .navbar-collapse {
	width: auto !important;
	max-width: var(--m58-maxw) !important;
	margin: 0 auto;
	overflow: visible !important;
}
#nv.navbar .navbar-collapse .navbar-nav li {
	width: auto !important;
	height: auto !important;
	line-height: 1.4 !important;
	border: none !important;
	background: none !important;
}
#nv.navbar .navbar-collapse .navbar-nav li a {
	float: none !important;
	width: auto !important;
	height: auto !important;
	line-height: 1.4 !important;
	padding: 14px 20px !important;
	font-size: 16px !important;
	font-weight: 500;
	color: var(--m58-text) !important;
	background: none !important;
	position: relative;
}
#nv.navbar .navbar-collapse .navbar-nav li a:hover {
	background: none !important;
	color: var(--m58-primary) !important;
}
#nv.navbar .navbar-collapse .navbar-nav .a,
#nv.navbar .navbar-collapse .navbar-nav .a a {
	background: none !important;
	color: var(--m58-primary) !important;
	font-weight: 600;
}
#nv.navbar .navbar-collapse .navbar-nav .a a::after {
	content: "";
	position: absolute;
	left: 20px; right: 20px; bottom: 0;
	height: 3px;
	border-radius: 3px 3px 0 0;
	background: var(--m58-primary);
}

/* sub-nav strip under the main nav (if enabled) */
#mu { background: var(--m58-bg); border-bottom: 1px solid var(--m58-border); }
#mu ul { max-width: var(--m58-maxw); margin: 0 auto; }

/* site logo */
.m58-logo { max-height: 56px; width: auto; display: block; }
@media (max-width: 768px) { .m58-logo { max-height: 40px; } }

/* widthauto/min-width stragglers */
#wp, #hd .wp,
.min-1200, .min-1250 { min-width: 0 !important; }
.w-1200 { width: auto !important; }
.mw-1200 { max-width: var(--m58-maxw) !important; }

/* Discuz compiled core css sets body{min-width:1200px} — kill for responsive */
html, body { min-width: 0 !important; }

/* mobile: contain nav scroll and fluid search box */
@media (max-width: 768px) {
	#nv.navbar .navbar-collapse { overflow-x: auto !important; overflow-y: hidden !important; }
	.rtj1009-sousuo, .rtj1009-sousuo2 { width: auto !important; max-width: 100% !important; float: none !important; }
	.rtj1009-sousuo input[type="text"] { width: 100% !important; box-sizing: border-box; }
	.ren-header-centre h3 { float: none; }
}

/* forum search bar fluid on small screens */
@media (max-width: 768px) {
	#scbar, #scbar table, #scbar .scbar_txt_td { width: 100% !important; box-sizing: border-box; }
	#scbar_txt { width: 100% !important; }
	#scbar .scbar_type_td, #scbar .scbar_hot { display: none; }
}

/* forum index: sidebar holds only empty DIY placeholders — reclaim the space */
.ren-forums-sd { display: none !important; }
.ren-forums-mn, .ren-forums-sd-kai .ren-forums-mn { width: 100% !important; float: none !important; }

/* search results page: kill fixed 1500px container */
#nv_search #ct, #nv_search .wp, #ct.w {
	width: auto !important;
	max-width: var(--m58-maxw) !important;
	margin-left: auto !important;
	margin-right: auto !important;
}

/* thread list rows: hover + subtle zebra */
.tl tr:nth-child(even) th, .tl tr:nth-child(even) td { background: var(--m58-bg); }
.tl tr:hover th, .tl tr:hover td { background: var(--m58-primary-soft) !important; }
.tl tr { transition: background .12s ease; }

/* content thumbnails get a gentle zoom on hover */
.ren-common-left img, .rc-e12-ndiy img, .rc-e10-ndiy img { transition: transform .3s ease; }

/* ==========================================================================
   Section headers (injected by modern.js), search hero, mobile FAB, dark mode
   ========================================================================== */

.m58-sec-head {
	display: flex;
	align-items: center;
	padding: 4px 2px 10px;
}
.m58-sec-head span {
	font-size: 19px;
	font-weight: 700;
	color: var(--m58-text);
	line-height: 1.2;
	padding-left: 10px;
	border-left: 4px solid var(--m58-primary);
}
[id^=portal_block_] .module li { font-size: 15px; padding: 3px 0; }

/* homepage: search becomes prominent */
#nv_portal.pg_index .rtj1009-sousuo input[type="text"],
#nv_portal.pg_index .rtj1009-sousuo .px {
	font-size: 16px !important;
	padding: 12px 22px !important;
}
#nv_portal.pg_index .rtj1009-sousuo { transform: scale(1.06); transform-origin: left center; }

/* mobile floating post button */
.m58-fab {
	position: fixed;
	right: 16px;
	bottom: 76px;
	z-index: 400;
	background: var(--m58-primary);
	color: #fff !important;
	font-size: 16px;
	font-weight: 600;
	padding: 12px 20px;
	border-radius: 999px;
	box-shadow: 0 4px 14px rgba(228, 57, 60, .45);
}
.m58-fab:active { transform: scale(.96); }
@media (min-width: 769px) { .m58-fab { display: none; } }

/* ---------- dark mode (system preference) ---------- */
@media (prefers-color-scheme: dark) {
	:root {
		--m58-bg: #15171c;
		--m58-surface: #1e2128;
		--m58-border: #2c303a;
		--m58-text: #e8eaee;
		--m58-text-2: #a7adb8;
		--m58-text-3: #6b7280;
		--m58-primary-soft: #3a2224;
	}
	body { background: var(--m58-bg) !important; color: var(--m58-text); }
	.bg-white, .bg-body,
	.ren-common-row, .bm, .fl,
	#fixed-header-wrap, .ren-header-nav, #hd,
	#nv.navbar, .m58-auth-card,
	.ren-index-right-yi, .ren-index-right-e,
	.p_pop, .dropdown-menu {
		background: var(--m58-surface) !important;
		border-color: var(--m58-border) !important;
	}
	#wp, #ct { color: var(--m58-text); }
	.tl th, .tl td, .bm_c, .bm_h { background: var(--m58-surface) !important; color: var(--m58-text); }
	.xst, .tl a, .module li a, .ren-card a, #wp h1, #wp h2, #wp h3 { color: var(--m58-text) !important; }
	.xg1, .xg2 { color: var(--m58-text-3) !important; }
	input.px, textarea.pt, select.ps, #scbar_txt,
	.rtj1009-sousuo input[type="text"] {
		background: var(--m58-bg) !important;
		color: var(--m58-text) !important;
	}
	#article_content { color: var(--m58-text); }
	.pg a, .pgb a, .pg label { background: var(--m58-surface) !important; color: var(--m58-text) !important; }
}

/* ---------- header search: unify button with brand + pill shape ---------- */

.ren-search-btn, #ren-search-btn {
	background: var(--m58-primary) !important;
	border: none !important;
	border-radius: 0 999px 999px 0 !important;
	padding: 0 26px !important;
	height: 100% !important;
	min-height: 42px;
	cursor: pointer;
	transition: background .15s ease;
}
.ren-search-btn:hover, #ren-search-btn:hover { background: var(--m58-primary-dark) !important; }

/* input joins the button seamlessly: flatten its right cap */
.rtj1009-sousuo input[type="text"],
.rtj1009-sousuo .px {
	border-radius: 999px 0 0 999px !important;
	border-right: none !important;
	border-color: var(--m58-primary) !important;
}

/* breathing room between search and the publish button */
.ren-nav-postbtn { margin-left: 18px; }

/* search form: input and button share one flex row, equal heights */
#scform, .rtj1009-sousuo form {
	display: flex;
	align-items: stretch;
}
#scform .ren-search-input, .rtj1009-sousuo form input[type="text"] { flex: 1 1 auto; }
.ren-search-btn, #ren-search-btn { height: auto !important; min-height: 0; align-self: stretch; }

/* search container must not clip the taller pill input */
.rtj1009-sousuo, .rtj1009-sousuo2 {
	height: auto !important;
	overflow: visible !important;
}
#ren-ssk-txt.overflow-hidden { overflow: visible !important; }

/* ---------- share button + QR popup ---------- */
.m58-share-btn { display: block; text-align: center; }
.m58-share-pop {
	display: none;
	position: fixed;
	right: 80px;
	bottom: 120px;
	z-index: 500;
	background: var(--m58-surface);
	border: 1px solid var(--m58-border);
	border-radius: var(--m58-radius);
	box-shadow: var(--m58-shadow-lg);
	padding: 16px;
	text-align: center;
}
.m58-share-pop.m58-open { display: block; }
.m58-share-pop p { margin: 8px 0; color: var(--m58-text-2); font-size: 13px; }
.m58-share-pop .m58-copy {
	background: var(--m58-primary);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 7px 18px;
	cursor: pointer;
	font-size: 13px;
}
@media (max-width: 768px) {
	.m58-share-pop { right: 12px; bottom: 140px; }
}

/* ---------- classifieds filter chips ---------- */

.ren-list-flsx .rc-e11-ng {
	background: var(--m58-surface);
	border-radius: var(--m58-radius) !important;
	border-color: var(--m58-border) !important;
	padding: 10px 14px;
}
.ren-list-flsx th {
	font-weight: 600;
	color: var(--m58-text-3);
	white-space: nowrap;
	padding-top: 8px;
	font-size: 13px;
}
.ren-list-flsx .tbmu li { float: left; }
.ren-list-flsx .tbmu li a.ren-flsx-li {
	display: inline-block;
	padding: 4px 14px !important;
	margin: 3px 8px 3px 0;
	border-radius: 999px;
	border: 1px solid var(--m58-border);
	background: var(--m58-surface);
	font-size: 13px;
	color: var(--m58-text-2) !important;
	line-height: 1.6;
	height: auto !important;
	transition: all .15s ease;
}
.ren-list-flsx .tbmu li a.ren-flsx-li:hover {
	border-color: var(--m58-primary);
	color: var(--m58-primary) !important;
	background: var(--m58-primary-soft);
}
.ren-list-flsx .tbmu li.a a.ren-flsx-li {
	background: var(--m58-primary) !important;
	border-color: var(--m58-primary);
	color: #fff !important;
	font-weight: 600;
}
@media (max-width: 768px) {
	.ren-list-flsx tr { display: block; }
	.ren-list-flsx th { display: block; padding: 6px 0 0; }
	.ren-list-flsx td { display: block; }
	.ren-list-flsx .tbmu { white-space: nowrap; overflow-x: auto; display: flex; }
	.ren-list-flsx .tbmu li { float: none; flex: 0 0 auto; }
}

/* 简/繁 toggle button */
.m58-lang-btn {
	display: inline-block;
	float: left;
	margin: 10px 10px 0 0;
	width: 30px;
	height: 30px;
	line-height: 28px;
	text-align: center;
	border: 1px solid var(--m58-border);
	border-radius: 50%;
	font-size: 14px;
	color: var(--m58-text-2) !important;
	background: var(--m58-surface);
	transition: all .15s ease;
}
.m58-lang-btn:hover { border-color: var(--m58-primary); color: var(--m58-primary) !important; }

/* ---------- article reading progress + hot reads rail ---------- */

.m58-progress {
	position: fixed;
	top: 0; left: 0;
	height: 3px;
	width: 0;
	background: var(--m58-primary);
	z-index: 999;
	transition: width .1s linear;
}

.m58-hot-reads {
	margin-top: 16px;
	background: var(--m58-surface);
	border: 1px solid var(--m58-border);
	border-radius: var(--m58-radius);
	box-shadow: var(--m58-shadow);
	padding: 14px 16px;
}
.m58-hot-reads h3 {
	font-size: 16px;
	font-weight: 700;
	margin: 0 0 10px;
	padding-left: 9px;
	border-left: 4px solid var(--m58-primary);
}
.m58-hot-reads ol { margin: 0; padding: 0 0 0 22px; }
.m58-hot-reads li { margin: 7px 0; font-size: 14px; line-height: 1.45; }
.m58-hot-reads li a {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--m58-text);
}
.m58-hot-reads li a:hover { color: var(--m58-primary); }
.m58-hot-reads li::marker { color: var(--m58-primary); font-weight: 700; }

/* ---------- Discuz message pages as centered cards ---------- */

#messagetext, .alert_error, .alert_info, .alert_right {
	max-width: 560px;
	margin: 48px auto !important;
	background: var(--m58-surface) !important;
	border: 1px solid var(--m58-border) !important;
	border-radius: var(--m58-radius);
	box-shadow: var(--m58-shadow-lg);
	padding: 32px 36px !important;
}
#messagetext p:first-child { font-size: 17px; font-weight: 600; }

/* ---------- perf: skip offscreen rendering for homepage blocks ---------- */

#nv_portal.pg_index [id^=portal_block_] {
	content-visibility: auto;
	contain-intrinsic-size: auto 280px;
}

/* ---------- breadcrumb polish ---------- */

#pt {
	background: none !important;
	border: none !important;
	font-size: 13px;
}
#pt .z a, #pt a { color: var(--m58-text-3); }
#pt a:hover { color: var(--m58-primary); }
#pt em { color: var(--m58-text-3); }

/* ---------- hot threads block under posts + smooth scrolling ---------- */

@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}

.m58-hot-threads {
	margin: 16px 0;
	background: var(--m58-surface);
	border: 1px solid var(--m58-border);
	border-radius: var(--m58-radius);
	box-shadow: var(--m58-shadow);
	padding: 16px 20px;
}
.m58-hot-threads h3 {
	font-size: 17px;
	font-weight: 700;
	margin: 0 0 10px;
	padding-left: 9px;
	border-left: 4px solid var(--m58-primary);
}
.m58-hot-threads ul {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px 32px;
}
.m58-hot-threads li a {
	display: block;
	padding: 5px 0 5px 14px;
	position: relative;
	font-size: 14px;
	color: var(--m58-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.m58-hot-threads li a::before {
	content: "";
	position: absolute;
	left: 0; top: 50%;
	width: 5px; height: 5px;
	margin-top: -2px;
	border-radius: 50%;
	background: var(--m58-primary);
	opacity: .55;
}
.m58-hot-threads li a:hover { color: var(--m58-primary); }
@media (max-width: 768px) {
	.m58-hot-threads ul { grid-template-columns: 1fr; }
}

/* ---------- classifieds listing cards ---------- */

.ren_fl_xf {
	display: flex !important;
	align-items: stretch;
	gap: 16px;
	width: auto !important;
	height: auto !important;
	background: var(--m58-surface);
	border: 1px solid var(--m58-border);
	border-radius: var(--m58-radius);
	padding: 14px;
	margin-bottom: 12px;
	transition: box-shadow .15s ease, transform .15s ease;
}
.ren_fl_xf:hover {
	box-shadow: var(--m58-shadow-lg);
	transform: translateY(-2px);
}
.ren_fl_xf .ren_xf_pic {
	float: none !important;
	flex: 0 0 200px;
	border-radius: var(--m58-radius-sm);
	overflow: hidden;
}
.ren_fl_xf .ren_xf_pic img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .3s ease;
}
.ren_fl_xf:hover .ren_xf_pic img { transform: scale(1.04); }
.ren_fl_xf .ren_xf_xx {
	flex: 1 1 auto;
	min-width: 0;
	width: auto !important;
}
.ren_fl_xf .ren_xf_bt {
	font-size: 16px;
	font-weight: 600;
	color: var(--m58-text);
	line-height: 1.4;
}
.ren_fl_xf .ren_xf_bt:hover { color: var(--m58-primary); }
.ren_fl_xf .ren_xf_hx { color: var(--m58-text-2); font-size: 13px; }
.ren_fl_xf .ren_esc_txx { color: var(--m58-text-3); font-size: 12px; }
.ren_fl_xf .ren_price {
	flex: 0 0 auto;
	width: auto !important;
	min-width: 90px;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	font-size: 18px;
	font-weight: 700;
	color: var(--m58-primary);
	white-space: nowrap;
}

@media (max-width: 768px) {
	.ren_fl_xf { gap: 10px; padding: 10px; }
	.ren_fl_xf .ren_xf_pic { flex-basis: 110px; height: 82px; }
	.ren_fl_xf .ren_xf_bt { font-size: 15px; }
	.ren_fl_xf .ren_price { min-width: 0; font-size: 15px; align-items: flex-start; }
	.ren_fl_xf .ren_xf_tx { display: none; }
}

/* ---------- homepage section tab rows as pills ---------- */

.ren-card-menu a {
	display: inline-block;
	padding: 3px 12px !important;
	margin: 0 2px;
	border-radius: 999px;
	font-size: 13px;
	color: var(--m58-text-2) !important;
	background: none;
	transition: all .15s ease;
	height: auto !important;
	line-height: 1.7 !important;
}
.ren-card-menu a:hover,
.ren-card-menu a.a {
	background: var(--m58-primary-soft);
	color: var(--m58-primary) !important;
}

/* ---------- mobile: comfortable touch targets ---------- */

@media (max-width: 768px) {
	.pg a, .pg strong, .pgb a, .pg label {
		min-height: 42px;
		min-width: 42px;
		line-height: 42px !important;
		padding: 0 14px !important;
		font-size: 15px;
	}
	.pg, .pgb { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
}

/* homepage search scale-up is desktop-only (scale overflows small screens) */
@media (max-width: 768px) {
	#nv_portal.pg_index .rtj1009-sousuo { transform: none; }
}

/* ---------- image lightbox ---------- */

.m58-lightbox {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 1000;
	background: rgba(10, 12, 16, .92);
	align-items: center;
	justify-content: center;
}
.m58-lightbox.m58-open { display: flex; }
.m58-lightbox img {
	max-width: 92vw;
	max-height: 86vh;
	width: auto !important;
	height: auto !important;
	border-radius: 6px;
	box-shadow: 0 12px 48px rgba(0, 0, 0, .6);
}
.m58-lb-x, .m58-lb-prev, .m58-lb-next {
	position: absolute;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	border: none;
	cursor: pointer;
	border-radius: 50%;
	width: 46px; height: 46px;
	font-size: 22px;
	line-height: 1;
	transition: background .15s ease;
}
.m58-lb-x:hover, .m58-lb-prev:hover, .m58-lb-next:hover { background: rgba(255, 255, 255, .28); }
.m58-lb-x { top: 18px; right: 18px; }
.m58-lb-prev { left: 14px; top: 50%; margin-top: -23px; font-size: 30px; }
.m58-lb-next { right: 14px; top: 50%; margin-top: -23px; font-size: 30px; }
.m58-lb-dl {
	position: absolute;
	bottom: 22px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--m58-primary);
	color: #fff !important;
	padding: 9px 22px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
	box-shadow: 0 4px 14px rgba(228, 57, 60, .5);
}
@media (max-width: 768px) {
	.m58-lb-prev, .m58-lb-next { width: 40px; height: 40px; }
}
