/* ==========================================================================
   PHPWind frontend responsiveness (added by this patch, no core file changed).
   Loaded after style/txcss.css and images/wind/wind-reset.css from
   template/wind/header.htm, template/wind/readtpl.htm and simple_header.htm.

   Above 1080px nothing here changes the original 1000px skin.
   Breakpoints: 1080 shell -> 900 home + posting form -> 640 phone -> 430 small.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Fluid media. Harmless on desktop: every legacy asset is already smaller
      than its container, so only overflowing ones are pulled back.
   -------------------------------------------------------------------------- */
img,
video,
audio,
canvas,
embed,
object,
iframe,
input,
textarea,
select,
button {
	max-width: 100%;
}

img,
video {
	height: auto;
}

table {
	max-width: 100%;
}

/* Long unbroken URLs and CJK runs must never push a cell wider than the page. */
.t td,
.t th,
.t9 td,
.t9 th,
.t10 td,
.t10 th,
.r_one,
blockquote,
.quote,
.blockquote,
.blockquote3 {
	word-wrap: break-word;
	overflow-wrap: break-word;
	word-break: break-word;
}

/* --------------------------------------------------------------------------
   1. <= 1080px - the 1000px shell has to shrink with the window.
   -------------------------------------------------------------------------- */
@media screen and (max-width: 1080px) {
	.main,
	.mainBox {
		width: auto !important;
		margin: 0 8px;
	}

	#nav {
		width: auto !important;
	}

	#footer {
		min-width: 0 !important;
		width: auto !important;
	}

	/* bordered table wrappers: 98% / 99.8% plus a 1px border overflowed by a pixel */
	.t,
	.t5,
	.t9,
	.t10 {
		width: 100% !important;
		-webkit-box-sizing: border-box;
		box-sizing: border-box;
	}

	.spaceborder {
		max-width: 100%;
		-webkit-box-sizing: border-box;
		box-sizing: border-box;
	}

	/* mode/o skin (u.php, profile, article modes) */
	.wrapA,
	.wrapB,
	#nav-o {
		width: auto !important;
	}

	/* .tips li carries min-width:210px and floats three per row. */
	.tips li {
		min-width: 0 !important;
		width: auto !important;
		float: none !important;
		display: block;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
}

/* --------------------------------------------------------------------------
   2. <= 900px - homepage layout plus the posting form.
      The skin positions the logo strip, the announcement bar, the search box
      and the nav with absolute offsets against a 1000px canvas, so they have
      to re-enter the flow; the editor's two-pane layout is 860px wide.
   -------------------------------------------------------------------------- */
@media screen and (max-width: 900px) {
	.logoBar {
		padding: 8px 0;
	}

	.logoBar .links,
	.lhc88,
	.bushoufei,
	.searchTop,
	.mainNav {
		position: static !important;
		top: auto !important;
		left: auto !important;
		right: auto !important;
		bottom: auto !important;
		width: auto !important;
	}

	.logoBar .links {
		margin-top: 6px;
		font-size: 13px;
	}

	.logoBar .links a {
		margin: 0 5px 5px 0;
		padding: 4px 10px;
	}

	.bushoufei {
		display: block;
		margin: 4px 0;
		font-size: 14px;
	}

	.searchTop {
		margin-top: 8px;
		text-align: center;
	}

	.searchTop .txt {
		width: 55% !important;
	}

	/* Three-column banner row becomes a stack. */
	.kjBar .left,
	.kjBar .mid,
	.kjBar .right {
		float: none !important;
		width: auto !important;
		height: auto !important;
		margin: 0 0 8px !important;
		overflow: hidden;
	}

	.kjBar img {
		width: 100%;
	}

	.picList ul {
		width: auto !important;
	}

	.picList ul li a img {
		width: 45% !important;
		height: auto !important;
	}

	.mainNav {
		margin: 6px 0;
	}

	.mainNav ul li {
		padding: 0 8px 6px 0;
	}

	.mainNav a,
	.a03,
	.a04,
	.a05 {
		width: auto !important;
		padding: 0 14px;
		white-space: nowrap;
	}

	/* Horizontal nav: let it wrap instead of clipping at 1000px. */
	#nav {
		height: auto !important;
		line-height: normal !important;
		padding: 4px 0;
		text-align: left;
	}

	#nav ul {
		display: block;
		overflow: hidden;
	}

	#nav ul li {
		float: left;
	}

	#nav ul li a {
		width: auto !important;
		padding: 8px 14px;
		line-height: 1.4;
		font-size: 15px;
	}

	.xxqhead_scbar {
		height: auto;
		line-height: normal;
		padding: 6px 0;
	}

	.xxqhead_scbar .xxqhead_scbar_l,
	.xxqhead_scbar .xxqhead_scbar_c {
		float: none;
		display: block;
		padding: 4px 8px;
	}

	.xxqhead_scbar .xxqhead_scbar_r {
		float: none;
		width: auto !important;
		padding: 4px 8px;
	}

	/* mode/o two-column pages (user centre, article lists) stack. */
	.contentA,
	.contentA-left,
	.contentA-right,
	.sidebarA,
	.contentB,
	.contentB1,
	.sidebarB,
	.sidebarB1,
	.contentC,
	.contentC-main,
	.contentC-side,
	.sidebarC {
		float: none !important;
		width: auto !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
	}

	/* ---- posting form (post.php) ---- */

	/* Legacy form tables size themselves from their content, so the 100% width
	   never wins. Fixed layout forces it; anything still wider scrolls inside
	   its own box. */
	table.tkl {
		width: 100% !important;
		table-layout: fixed !important;
	}

	/* post.htm hard-codes desktop pixel widths and offsets in inline styles. */
	[style*="width:540px"],
	[style*="width:760px"],
	[style*="width:535px"],
	[style*="width:420px"] {
		width: auto !important;
	}

	[style*="margin-left:200px"],
	[style*="auto 0 205px"] {
		margin-left: 0 !important;
	}

	#editor-side {
		position: static !important;
		float: none !important;
		width: auto !important;
		margin-top: 0 !important;
	}

	#editor-main {
		padding-left: 0 !important;
		min-width: 0 !important;
	}

	/* The Wind editor toolbar is a row of fixed-width button groups; let it
	   scroll in its own box instead of widening the table that holds it. */
	.editor-mwidth {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.editor-mwidth > div {
		margin-left: 0 !important;
	}

	.editor-mwidth .fl,
	.editor-mwidth .fr {
		float: none !important;
		width: auto !important;
		margin-left: 0 !important;
	}

	.fr.pr {
		width: auto !important;
	}

	input[name="atc_title"] {
		width: 92% !important;
	}
}

/* --------------------------------------------------------------------------
   3. <= 640px - phone.
   -------------------------------------------------------------------------- */
@media screen and (max-width: 640px) {
	html,
	body {
		max-width: 100%;
		-webkit-text-size-adjust: 100%;
	}

	.main,
	.mainBox {
		margin: 0 5px;
		padding-top: 2px;
	}

	/* Any legacy bordered table container scrolls sideways on its own, so a
	   wide thread list stays readable instead of squashing to one letter per
	   line or blowing the page out. */
	.t,
	.t5,
	.t9,
	.t10,
	.xxqbbslist,
	.bbsgstz,
	.bgk000,
	.conBox {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	/* Top login / register bar wraps to two rows. */
	#nav-user {
		float: none !important;
		padding: 2px 6px !important;
	}

	#nav-user td {
		padding: 2px 6px 2px 0 !important;
	}

	/* Index forum list. */
	.bbsgstz col:first-child {
		width: 40px;
	}

	.topic,
	.reply {
		margin-left: 0 !important;
	}

	/* Thread list toolbar and the inline search box. */
	#nav-s {
		width: auto !important;
		height: auto !important;
		float: none !important;
		background: none !important;
		overflow: visible;
		padding: 4px 8px;
	}

	#nav-s .fr {
		margin: 0;
	}

	.s-input {
		width: 45% !important;
		margin: 0 0 0 6px !important;
	}

	#nav-global ul,
	#nav-global div {
		padding-left: 8px !important;
	}

	.threadlist {
		position: static !important;
		padding-left: 0;
	}

	.threadlist a {
		padding: 0 7px;
	}

	/* User centre (u.php) is a fixed 940px frame with two floated columns. */
	#u-wrap2 {
		width: auto !important;
		margin: 0 5px;
	}

	#u-sidebar,
	#u-content,
	#u-contentside,
	#u-contentmain {
		float: none !important;
		width: auto !important;
		border-left: 0 !important;
		padding-left: 0 !important;
	}

	#u-top {
		height: auto;
		min-height: 70px;
		position: static;
	}

	/* Private messages (message.php): sidebar tabs above the list. */
	#set-side,
	.set-content-right {
		float: none !important;
		width: auto !important;
	}

	#set-content,
	#set-content-wrap {
		margin-left: 0 !important;
		float: none !important;
		width: auto !important;
	}

	/* Search page. */
	.forum-search {
		width: auto !important;
		margin: 5px !important;
		padding: 5px !important;
	}

	.forum-search > div {
		padding-left: 0 !important;
	}

	.forum-search input[type="text"] {
		width: 50% !important;
	}

	.forum-search span {
		padding-right: .5em;
	}

	/* Legacy skins size spacer divs (post.php header row, u.php bars) in px,
	   which sets the min-content width of the table that contains them. */
	div.c {
		width: auto !important;
	}

	/* User-centre search bar (mode/o). */
	#searchbar-h {
		width: auto !important;
		float: none !important;
	}

	/* Everything the skins size with a fixed px width inside a form cell. */
	.pform input,
	.pform textarea,
	.pform select,
	.t form input[type="text"],
	.t form textarea {
		max-width: 96%;
		-webkit-box-sizing: border-box;
		box-sizing: border-box;
	}

	/* Quotes and code blocks no longer keep their desktop percentages. */
	.quote,
	.blockquote,
	.blockquote3 {
		width: auto !important;
		margin-left: 0;
		margin-right: 0;
	}

	/* Page links need bigger tap targets. */
	.pgd a,
	.pgd strong,
	.mnav a {
		padding: 4px 6px;
		display: inline-block;
	}
}

/* --------------------------------------------------------------------------
   4. Post share bar - centered, polished green pill.
   -------------------------------------------------------------------------- */
.pw-share-bar {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	padding: 18px 0 12px;
	text-align: center;
}

.pw-share-trigger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 9px 20px;
	border: 1px solid rgba(0, 148, 74, .45);
	border-radius: 9999px;
	background: #00a651;
	background: linear-gradient(135deg, #17c47a 0%, #00a651 58%, #008f47 100%);
	color: #fff !important;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: .5px;
	text-decoration: none;
	vertical-align: middle;
	box-shadow: 0 4px 12px rgba(0, 166, 81, .30), inset 0 1px 0 rgba(255, 255, 255, .28);
	-webkit-transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
	transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.pw-share-trigger:hover,
.pw-share-trigger:focus {
	background: #00b45a;
	background: linear-gradient(135deg, #1ed187 0%, #00b45a 58%, #009c50 100%);
	color: #fff !important;
	text-decoration: none;
	-webkit-transform: translateY(-1px);
	transform: translateY(-1px);
	box-shadow: 0 7px 18px rgba(0, 166, 81, .38), inset 0 1px 0 rgba(255, 255, 255, .35);
}

.pw-share-trigger:active {
	-webkit-transform: translateY(0);
	transform: translateY(0);
	box-shadow: 0 3px 8px rgba(0, 166, 81, .26), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.pw-share-trigger:focus-visible {
	outline: 2px solid rgba(0, 166, 81, .45);
	outline-offset: 2px;
}

.pw-share-trigger svg {
	display: block;
	width: 15px;
	height: 15px;
}

/* --------------------------------------------------------------------------
   5. <= 430px - small phone: drop the remaining decorative columns.
   -------------------------------------------------------------------------- */
@media screen and (max-width: 430px) {
	#nav ul li a {
		padding: 8px 10px;
		font-size: 14px;
	}

	.picList ul li a img {
		width: 100% !important;
	}

	.searchTop .txt {
		width: 70% !important;
	}

	/* Thread rows: author and post-date columns go, subject gets the room.
	   Cells are status / subject / author / replies / date. */
	#ajaxtable .tr2 td:nth-child(3),
	#ajaxtable .tr2 td:nth-child(5),
	#ajaxtable tr.tr3 td:nth-child(3),
	#ajaxtable tr.tr3 td:nth-child(5) {
		display: none;
	}

	#ajaxtable td,
	#ajaxtable th {
		padding-left: 4px !important;
		padding-right: 4px !important;
	}
}
