@CHARSET "UTF-8";

/* Mobile-responsive overrides for Travian T4 (RTL) — keeps original look on desktop */

meta, html {
	-webkit-text-size-adjust: 100%;
}

img, video, iframe {
	max-width: 100%;
}

/* Sprite icons (1×1 x.gif + background) must stay fixed size — max-width:100% clips them in narrow .ico cells */
img.unit,
img.r1,
img.r2,
img.r3,
img.r4,
img.r5,
img.att_all,
img.def_i,
img.def_c,
img.hero_on_adventure,
img#lswitch,
img.clickareas {
	max-width: none !important;
}

/* Soften fixed desktop shell on smaller screens */
@media screen and (max-width: 1024px) {
	body {
		min-width: 0 !important;
		overflow-x: auto;
	}

	body #wrapper .bodyWrapper,
	#mid {
		width: 100% !important;
		max-width: 990px;
		min-width: 0 !important;
		box-sizing: border-box;
	}

	#contentOuterContainer {
		margin-right: 0 !important;
		margin-left: 0 !important;
		float: none !important;
		width: auto !important;
		max-width: 100%;
		box-sizing: border-box;
	}

	body.village1 #contentOuterContainer,
	body.village2 #contentOuterContainer {
		width: auto !important;
		margin-right: 0 !important;
		margin-left: 0 !important;
	}

	#side_info {
		float: none !important;
		width: auto !important;
		max-width: 100%;
		top: 0 !important;
		margin: 10px auto !important;
		position: relative !important;
	}

	#side_navi {
		float: none !important;
		width: auto !important;
		margin: 0 auto 10px auto !important;
	}

	#header,
	#mtop,
	#navigation {
		max-width: 100%;
	}

	div.greenbox,
	div.greenbox div.greenbox-top,
	div.greenbox div.greenbox-bottom,
	div.greenbox div.greenbox-content {
		width: 100% !important;
		max-width: 551px;
		box-sizing: border-box;
	}

	table {
		max-width: 100%;
	}

	#res {
		width: 100% !important;
		min-width: 0 !important;
		max-width: 100% !important;
		right: 0 !important;
		left: 0 !important;
		position: relative !important;
		top: auto !important;
		display: flex !important;
		flex-wrap: wrap;
		justify-content: center;
		direction: rtl;
		gap: 6px 10px;
		padding: 8px 10px !important;
		box-sizing: border-box;
		overflow: hidden;
		background: #fff !important;
		border-radius: 8px;
		box-shadow: 0 2px 8px rgba(20, 32, 18, 0.14);
	}
	#res li {
		float: none !important;
		width: auto !important;
		min-width: 88px;
		flex: 1 1 88px;
		max-width: 140px;
	}
	#res li.r5 {
		max-width: 120px;
	}
	#res li p {
		display: flex !important;
		flex-direction: row;
		align-items: center;
		gap: 4px;
		direction: rtl;
	}
	#res li p .value {
		position: static !important;
		left: auto !important;
		right: auto !important;
		display: block;
		flex: 1 1 auto;
		min-width: 0;
		max-width: 100%;
		font-size: 9px !important;
		text-align: right !important;
	}
	#res li .bar-bg {
		width: 100% !important;
	}
}

@media screen and (max-width: 768px) {
	body {
		font-size: 12px;
		line-height: 1.4;
		background-attachment: scroll !important;
	}

	body #wrapper #staticElements {
		display: none !important;
	}

	#header {
		height: auto !important;
		min-height: 70px;
		padding-bottom: 8px;
	}

	#logo {
		transform: scale(0.85);
		transform-origin: top right;
	}

	#navigation {
		display: flex !important;
		flex-wrap: wrap;
		justify-content: center;
		gap: 4px;
		width: 100% !important;
		margin: 0 auto !important;
		padding: 0 !important;
		list-style: none !important;
	}

	#navigation li {
		float: none !important;
		display: inline-block !important;
	}

	#mid {
		min-height: 0 !important;
		padding: 0 6px;
		box-sizing: border-box;
	}

	#contentOuterContainer .contentContainer,
	#content {
		padding-left: 10px !important;
		padding-right: 10px !important;
		box-sizing: border-box;
	}

	#content {
		overflow-x: auto;
	}

	/* Do not let village1 content/scrollport clip troop sprites */
	body.village1 #content,
	#content.village1 {
		overflow: visible !important;
	}

	/* Village map / resource field areas: allow horizontal scroll instead of clipping.
	   Keep #map_details overflow-y visible so troop icons are not cut (overflow-x:auto
	   would force overflow-y to auto and clip sprites). */
	#village_map,
	div.map,
	div#map,
	#content.village1,
	#content.village2 {
		max-width: 100%;
		overflow-x: auto;
	}

	div.village1 #map_details,
	#content.village1 #map_details,
	#map_details {
		max-width: 100%;
		overflow: visible !important;
		position: relative !important;
		right: auto !important;
		left: auto !important;
		top: auto !important;
		width: 100% !important;
	}

	div.village1 #map_details .boxes,
	div.village1 #map_details .boxes.units,
	div.village1 #map_details .boxes.production,
	div.village1 #map_details .boxes.movements {
		float: none !important;
		width: 100% !important;
		max-width: 245px;
		margin: 0 0 10px auto;
		overflow: visible !important;
	}

	#side_info .news,
	#side_info .sideInfoHero,
	#side_info .sideInfoPlayer,
	#side_info .sideInfoAlly {
		margin-left: auto !important;
		margin-right: auto !important;
	}

	div#side_navi ul li {
		width: 100% !important;
		max-width: 200px;
		margin-left: auto;
		margin-right: auto;
	}

	input[type="text"],
	input[type="password"],
	input[type="email"],
	select,
	textarea {
		max-width: 100%;
		box-sizing: border-box;
	}

	/* Login / outside pages */
	body.login #mid,
	body.logout #mid,
	body.signup #mid,
	body.activate #mid {
		width: 100% !important;
	}

	.banner {
		width: 100% !important;
		max-width: 300px;
		height: auto !important;
		margin-right: auto !important;
		margin-left: auto !important;
	}
}

@media screen and (max-width: 480px) {
	body {
		font-size: 11px;
	}

	#mtop {
		text-align: center;
	}

	#navigation li a {
		transform: scale(0.9);
	}

	#contentOuterContainer .contentTitle,
	#contentOuterContainer .contentFooter {
		background-size: 100% 100%;
	}

	/* Keep tables usable on phones — but NEVER break nested warsim / village side tables into block/nowrap white boxes */
	table.row_table_data,
	table.rank,
	table#overview,
	table#member,
	#content table {
		display: block;
		overflow-x: auto;
		white-space: nowrap;
		max-width: 100%;
	}

	body.warsim #content table,
	#content.warsim table,
	#content.warsim table#select,
	#content.warsim table.fill_in,
	#content.warsim table.fill_in td.details table,
	#content.warsim table.results,
	div.village1 table#troops,
	div.village1 table#production,
	div.village1 table#movements,
	#content.village1 table#troops,
	#content.village1 table#production,
	#content.village1 table#movements {
		display: table !important;
		white-space: normal !important;
		overflow: visible !important;
		max-width: 100%;
	}

	div.village1 table#troops tbody,
	div.village1 table#production tbody,
	div.village1 table#movements tbody,
	#content.village1 table#troops tbody,
	#content.village1 table#production tbody,
	#content.village1 table#movements tbody {
		display: table-row-group !important;
	}

	div.village1 table#troops tr,
	div.village1 table#production tr,
	div.village1 table#movements tr,
	#content.village1 table#troops tr,
	#content.village1 table#production tr,
	#content.village1 table#movements tr {
		display: table-row !important;
	}

	div.village1 table#troops th,
	div.village1 table#troops td,
	div.village1 table#production th,
	div.village1 table#production td,
	div.village1 table#movements th,
	div.village1 table#movements td,
	#content.village1 table#troops th,
	#content.village1 table#troops td,
	#content.village1 table#production th,
	#content.village1 table#production td,
	#content.village1 table#movements th,
	#content.village1 table#movements td {
		display: table-cell !important;
		white-space: nowrap;
	}

	body.warsim #content table tbody,
	#content.warsim table tbody {
		display: table-row-group !important;
	}

	body.warsim #content table tr,
	#content.warsim table tr {
		display: table-row !important;
	}

	body.warsim #content table th,
	body.warsim #content table td,
	#content.warsim table th,
	#content.warsim table td {
		display: table-cell !important;
		white-space: normal;
	}

	body.login #side_navi,
	body.logout #side_navi,
	body.signup #side_navi,
	body.activate #side_navi {
		float: none !important;
		width: 100% !important;
		margin: 0 0 12px 0 !important;
	}

	body.login #contentOuterContainer,
	body.logout #contentOuterContainer,
	body.signup #contentOuterContainer {
		float: none !important;
		width: 100% !important;
		margin: 0 !important;
	}

	body.login #content table {
		width: 100% !important;
	}

	body.login #content img[src*="CaptchaSecurityImages"] {
		max-width: 160px;
		height: auto;
	}
}
