/*********************************************************
 * Global
 *********************************************************/

 html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	overflow: visible;
	overscroll-behavior-x: contain;
}
html {
	scrollbar-width: none;
	position: relative;
	height: 100dvh;
	/* failed attempt to fix mobile height */
	/* height: 100lvh; */
}
html.scroll-frame-enabled,
html.scroll-frame-enabled body {
	overflow-x: hidden;
}
body {
	color: white;
	font-size: 11pt;
	font-family: Verdana, Helvetica, Arial, sans-serif;

	/* see https://pokemonshowdown.com/credits */
	background: #344b6c url(../fx/client-bg-charizards.jpg) no-repeat left center fixed;
	-webkit-background-size: cover;
	-moz-background-size: cover;
	-o-background-size: cover;
	background-size: cover;
}

.pad {
	margin: 0;
	padding: 5px 15px;
}
.tiny-layout .pad {
	padding: 4px 7px;
}
.pad p {
	margin: 9px 0;
}
.buttonbar {
	margin-top: 1em;
	text-align: center;
}

.dark .tabbar .button,
.dark .tabbar .button:hover,
.dark .header-vertical .tablist .button,
.dark .header-vertical .tablist .button:hover {
	box-shadow: inset 0.5px 1px 1px rgba(255, 255, 255, 0.5);
}
.dark .tabbar .button:active,
.dark .tabbar .button.cur,
.dark .tabbar .button.cur:hover,
.dark .tabbar .button.cur:active,
.dark .header-vertical .tablist .button:active,
.dark .header-vertical .tablist .button.cur,
.dark .header-vertical .tablist .button.cur:hover,
.dark .header-vertical .tablist .button.cur:active {
	box-shadow: none;
}

pre {
	white-space: pre-wrap;
	word-wrap: break-word;
}

.construction {
	border: 15px solid transparent;
	padding: 5px 10px;
	background: #d9ca28;
	/* opera doesn't support single-arg linear-gradient */
	background-image: linear-gradient(#d9ca28, #d9ca28), repeating-linear-gradient(
		-45deg,
		#d9ca28,
		#d9ca28 10px,
		#292824 10px,
		#292824 20px
	);
	background-origin: border-box;
	background-clip: padding-box, border-box;

	padding: 5px 10px;
	font-weight: bold;
	color: black;
}

ul {
	padding-left: 1.5em;
}
li::marker {
	color: #888;
}

/*********************************************************
 * Header
 *********************************************************/

.ps-frame,
.ps-scroll-frame,
.ps-scroll-content {
	height: 100%;
}
.ps-frame {
	position: relative;
}
.ps-scroll-content {
	position: relative;
}
.scroll-frame-enabled .ps-scroll-frame {
	width: 100%;
	overflow: hidden;
}
.scroll-frame-enabled .ps-scroll-content {
	width: calc(100vw + 280px);
}

.scroll-snap-enabled {
  scroll-snap-type: x mandatory;
}
.scroll-snap-enabled .header-vertical {
	scroll-snap-align: start;
}
.scroll-snap-enabled .mini-header {
	scroll-snap-align: start;
}

.header {
	position: relative;
	height: 50px;
	background: url(../fx/client-topbar-bg.png) repeat-x left top scroll;
}
.header h1 {
	margin: 0;
	padding: 0;
}
.header .logo {
	display: block;
	margin: 0;
}
.header-vertical {
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 243px;
	padding-right: 7px;
	background: rgba(255,255,255,.3);
}
.dark .header, .dark .header-vertical {
	background: rgba(0,0,0,.30);
}

.userbar {
	position: absolute;
	top: 12px;
	right: 12px;
}
.header-vertical .userbar {
	right: auto;
	top: auto;
	left: 12px;
	bottom: 12px;
	right: 17px;
	word-wrap: break-word;
}
.userbar .username {
	font-weight: bold;
	color: black;
	text-shadow: 1px 1px 0 #f8f8f8, 1px -1px 0 #f8f8f8, -1px 1px 0 #f8f8f8, -1px -1px 0 #f8f8f8;
}
.dark .userbar .username, .dark .mini-header-right {
	color: #DDD;
	text-shadow: 1px 1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000;
}
.username {
	cursor: pointer;
}
@media (max-width: 500px) {
	.header-vertical .usernametext {
		display: inline;
	}
}
.userbar button.icon {
	height: 25px;
	width: 27px;
	font-size: 16px;
	text-align: center;
	padding: 0;
}
.userbar button.icon i {
	margin: 0 -5px;
}

.mini-header, .maintabbarbottom, .tabbar:after {
	background: #f8f8f8;
	border: solid 1px #AAAAAA;
	color: black;
}
.maintabbarbottom {
	content: "";
	display: block;
	position: absolute;
	left: 0;
	right: 0;
	top: 49px;
	height: 6px;
	border-left-width: 0;
	border-right-width: 0;
	margin: -1px 0 0 0;
	-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
	-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
	box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.mini-header {
	position: absolute;
	left: 249px;
	right: 0;
	top: 0;
	padding: 0;
	height: 29px;
	line-height: 29px;
	white-space: nowrap;
	border-left: 0;
	border-right: 0;
	border-top: 0;
	overflow: hidden;
}
.mini-header i.text, .tablist i.text {
	font-size: 11px;
	font-style: normal;
	font-weight: bold;
	border: 1px solid #777;
	padding: 1px 3px;
	border-radius: 5px;
	vertical-align: middle;
	margin-top: -2px;
	display: inline-block;
	line-height: 12px;
}
.tablist .roomtab-battle i.text {
	display: block;
	border: 0;
	padding: 3px 0 0;
}
.mini-header-right, .mini-header-left {
	float: right;
	background: transparent;
	color: inherit;
	font-family: inherit;
	font-size: inherit;
	line-height: inherit;
	border: 0;
	border: 1px solid #777;
	border-width: 0 0 0 1px;
	padding: 0 9px;
}
.mini-header-left {
	float: left;
	border-width: 0 1px 0 0;
	margin-right: 5px;
}
.mini-header-right {
	position: absolute;
	top: 0;
	right: 0;
	background: inherit;
}
.mini-header-left.notifying {
	color: #AA6600;
}
.dark .mini-header-left.notifying {
	color: #72bcda;
}
.notification-badge {
	position: absolute;
	top: 2px;
	left: 13px;
	width: 15px;
	height: 15px;
	background: #e9790d;
	color: white;
	font-size: 9px;
	font-weight: bold;
	line-height: 14px;
	text-align: center;
	border-radius: 50%;
}

/* for debugging */
/* .scroll-snap-enabled .maintabbarbottom {
	background: green !important;
} */

.header-vertical .scrollable-part {
	position: absolute;
	top: 0;
	bottom: 50px;
	left: 0;
	right: 7px;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
}
.header-vertical .maintabbarbottom {
	top: 0;
	bottom: 0;
	left: auto;
	right: 0;
	width: 6px;
	height: auto;
	border-top: 0;
	border-bottom: 0;
	border-left-width: 1px;
	border-right-width: 1px;
	margin: 0;
}
.dark .mini-header, .dark .maintabbarbottom, .dark .tabbar:after {
	background: #555555;
	border-color: #34373b;
	color: #DDDDDD;
}
.dark .maintabbarbottom {
	border-bottom-color: #5A5A5A;
}

.tabbar {
	display: block;
	list-style: none;
	margin: 0;
	padding: 2px 0 0 0;
	text-align: left;

	color: white;
	text-shadow: 0 1px 0 black;
	font-size: 10pt;

	line-height: 100%;
}
.tabbar:after {
	content: "";
	display: block;
	height: 6px;
	margin: -1px 0 0 0;
	-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
	-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
	box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.tabbar.maintabbar:after {
	display: none;
}
.tabbar.maintabbar {
	/* margin-left: 52px; */
	padding: 0;
	margin-right: 180px;
	overflow: hidden;
	white-space: nowrap;
}
.maintabbar .inner-1 {
	display: table; /* ;) */
	width: 100%;
	height: 49px;
	line-height: 49px;
}
.maintabbar .inner-2 {
	display: table-row;
}
.header .overflow {
	position: absolute;
	bottom: 0;
	right: 180px;
	z-index: 12;
}
.header .overflow .button {
	height: 37px;
	width: 32px;
	font-size: 12pt;
	margin: 0;
	border-radius: 0;
}

.button.subtle-notifying .fa-comment-o:before,
.button.notifying .fa-comment-o:before {
	content: "\f0e6";
}

.tabbar ul {
	display: block;

	list-style: none;
	margin: 0;
	padding: 0;
}
.tabbar .maintabbar-left, .tabbar .maintabbar-right {
	display: table-cell;
	list-style: none;
	margin: 0;
	padding: 0;
}
.tabbar .maintabbar-right {
	padding-right: 1px;
}
.tabbar li {
	display: inline-block;
	vertical-align: bottom;
	line-height: normal;
}
.tabbar .button {
	display: inline-block; /* to align it with the close button */
	white-space: nowrap;

	position: relative;
	margin: 0 -1px 0 0;
	border-radius: 0;
	box-shadow: inset 0 -1px 2px rgba(255,255,255,1);
}
.maintabbar .button {
	height: 28px;
	min-width: 52px;
	padding: 3px 2px 3px 2px;
	font-size: 11px;
}
.tabbar .button i {
	display: block;
	text-align: center;
	margin: 1px auto 0 auto;
	font-style: normal;
	font-size: 14px;
	height: 14px;
}
.tabbar .button i.rooms-plus {
	margin: 7px auto -6px auto;
}
.tabbar .button i.text {
	font-size: 11px;
	margin-right: 8px;
	padding-left: 0;
	overflow: hidden;
	font-weight: bold;
}
.tabbar .button i.text + span {
	margin-right: -6px;
}
.tabbar .button:hover,
.tablist .button:hover,
.tabbar .button:focus,
.tablist .button:focus {
	z-index: 10;
}
.tabbar .button.cur,
.tabbar .button.cur:hover {
	box-shadow: none;
	border-bottom: 0;
	padding-top: 3px;
	padding-bottom: 5px;
}
.tabbar li:first-child .button, .tabbar li.home-li .button, .tabbar li.home-li + li .button, .tabbar .button-first {
	border-top-left-radius: 5px;
	margin-left: 6px;
}
.tabbar li:last-child .button, .tabbar li.home-li .button, .tabbar .button-last {
	border-top-right-radius: 5px;
}
.tabbar a.closable {
	padding-right: 8px;
}
.tabbar .closebutton {
	display: inline-block;
	margin: 0 0 0 -17px;
	width: 17px;
	text-align: left;
	top: 3px;
	vertical-align: top;
	position: relative;
	z-index: 11;
}
.tabbar a.cur + .closebutton {
	top: 2px;
}
.closebutton,
.maximizebutton,
.minimizebutton {
	text-decoration: none;
	font-size: 14px;
	color: #999999;
	text-shadow: none;
	border: 0;
	padding: 0;
	margin: 0;
	background: transparent;
	cursor: pointer;
}
.closebutton:hover {
	color: #BB2222;
}
.dark .closebutton:hover {
	color: #EE7777;
}
.minimizebutton:hover,
.maximizebutton:hover,
summary:hover .expandbutton,
.mini-window-header:hover .minimizebutton {
	color: #333333;
}
.dark .minimizebutton:hover,
.dark .maximizebutton:hover,
.dark summary:hover .expandbutton,
.dark .mini-window-header:hover .minimizebutton {
	color: #CCCCCC;
}
.mini-window-header .closebutton:hover + button + .minimizebutton,
.mini-window-header .maximizebutton:hover + .minimizebutton {
	color: #999999 !important;
}
.closebutton:active,
.maximizebutton:active,
.minimizebutton:active {
	color: #661111;
}
.collapsed .minimizebutton .fa-minus-circle:before {
	/** replace the minus with a plus when PM is minimized */
	content: "\f055";
}

.tablist li, .tablist ul {
	/** tablist is the menu that's displayed when the window is too wide for all the tabs */
	list-style: none;
	margin: 0;
	padding: 0;
}
.tablist ul {
	padding: 5px 8px;
	width: 200px;
}
.tablist li {
	clear: both;
	margin: -1px 0 0 0;
	padding: 0;
}
.tablist .button {
	position: relative;
	box-shadow: inset 0 0px 2px rgba(255,255,255,1);
	font-size: 11pt;
	padding: 4px 28px 4px 6px;
	width: auto;
	height: 18px;
	text-align: left;
	border-radius: 0;
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.tablist .button.roomtab-battle {
	height: auto;
}
.tablist li:first-child .button {
	border-top-left-radius: 5px;
	border-top-right-radius: 5px;
}
.tablist li:last-child .button {
	border-bottom-left-radius: 5px;
	border-bottom-right-radius: 5px;
}
.header-vertical .tablist ul {
	padding: 3px 0 4px 5px;
	width: auto;
}
.header-vertical .tablist li .button {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
	border-right-width: 0;
	margin: 0 1px 0 2px;
	box-shadow: none;
}
.tablist li .button.cur {
	margin: 0;
}
.tablist .closebutton {
	display: block;
	float: right;
	margin-top: -28px;
	margin-right: 4px;
	padding: 5px 0 0 0;
	height: 23px;
	font-size: 16px;
	width: 24px;
	text-align: center;

	position: relative;
	z-index: 11;
}

/*********************************************************
 * Rooms
 *********************************************************/

.ps-room {
	position: absolute;
	display: block;
	top: 56px;
	left: 0;
	right: 0;
	bottom: 0;

	border-left: 1px solid #AAAAAA;
	margin-left: -1px;
}
.dark .ps-room {
	border-color: #34373b;
}
.scrollable {
	overflow: auto;
	-webkit-overflow-scrolling: touch;
}
.ps-room.ps-room-light, .ps-room-light {
	background: rgba(242,247,250,.85);
	color: black;
}
.ps-room.ps-room-opaque, .ps-room-opaque {
	background: #EEF2F5;
	color: black;
}

.ps-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: #CCCCCC;
	background: rgba(212, 212, 212, .5);

	overflow: auto;
	-webkit-overflow-scrolling: touch;
	z-index: 20;
}
.dark .ps-overlay {
	background: rgba(40, 40, 40, .5);
}
.ps-popup {
	position: absolute;
	top: auto; right: auto; left: auto; bottom: auto;
	text-align: left;
	background: #E1E8E8;
	color: black;
	border: 1px solid #999999;

	border-radius: 6px;
	box-shadow: inset 1px 1px 0 #ffffff, inset -1px -1px 0 #DDDDDD, 2px 2px 3px rgba(0,0,0,.2);
	z-index: 20;
}
.dark .ps-popup {
	background: #0D151E;
	color: #DDD;
	border-color: #34373b;

	box-shadow: 2px 2px 3px rgba(0,0,0,.5), inset 0.5px 1px 1px rgba(255, 255, 255, 0.5);
}

.ps-overlay .ps-popup {
	position: static;
	margin: 80px auto 20px auto;
	max-width: 320px;
}
.ps-popup p,
.ps-popup h3 {
	margin: 7px 0;
}
.ps-popup h3 {
	font-size: 12pt;
}
p.or {
	font-size: 12pt;
	font-style: italic;
	font-weight: bold;
	color: #444444;
	margin: 20px 0;
	text-align: center;
}
p.or:before,
p.or:after {
	content: "";
	font-size: 10px;
	padding: 0 0 0 85px;
	margin: 0 9px 0 0;
	border-bottom: 1px solid #777777;
	position: relative;
	top: -7px;
}
p.or:after {
	margin: 0 0 0 9px;
}
.ps-popup p.error {
	font-weight: bold;
	color: #EE4422;
}

.options {
	margin: -2px 0 -1px 0;
	padding: 0 2px;
	list-style: none;
	font-size: 8pt;
	float: left;
}
.options .option {
	display: block;
	width: 220px;
	box-sizing: border-box;
}
.options .star {
	float: right;
}
.options .star {
	color: #888;
}
.options .star:hover {
	color: #1ea1c8;
}
.options .star.cur {
	color: #FFD700;
	text-shadow: 0 0 1px #000;
}
.options h3 {
	margin: 5px 0 0 -2px;
	padding: 1px 0;
	font-size: 8pt;
	color: #579;
}
.options li:first-child h3 {
	margin-top: 0;
}
@media (max-height:590px) {
	.options h3 {
		margin-top: 2px;
	}
	.options {
		margin: -3px 0 -2px 0;
	}
}
@media (max-height:518px) {
	.options h3 {
		margin-top: 1px;
	}
}

/*********************************************************
 * Main menu
 *********************************************************/

.mainmenu {
	position: sticky;
	top: 0;
	min-height: 100%;
}

.mainmenu-left {
	padding: 25px 0 51px 0;
	width: 300px;
}
.mainmenu-right {
	position: absolute;
	top: 25px;
	right: 0;
	width: 300px;
}
.mainmenu-mini-windows {
	/* slightly overlaps with leftmenu but less than the margins */
	position: absolute;
	left: 295px;
	top: 0;
	width: 312px;
	min-height: 2px;
	padding: 25px 0 51px 0;
}
.mini-window {
	position: relative;
	z-index: 1;
}

.mainmenu-footer {
	position: absolute;
	bottom: 0;
	left: 0;
	padding: 0 0 15px 20px;
	color: #BBBBBB;
	text-shadow: 0 0 3px black, 0 0 3px black, 0 0 3px black;
}
.mainmenu-footer blockquote {
	margin: 0 0 1em 0;
	padding: 0;
}
.mainmenu-footer small {
	font-size: 9pt;
}
.mainmenu-footer small small {
	font-size: 8pt;
}
.mainmenu-footer a, .mainmenu-footer button {
	background: transparent;
	border: 0;
	padding: 0;
	text-shadow: 0 0 3px black, 0 0 3px black, 0 0 3px black;

	text-decoration: underline;
	color: #99BBEE;
}
.mainmenu-footer a:hover, .mainmenu-footer button:hover {
	text-decoration: underline;
	color: #CCDDFF;
}

.mainmenu.tiny-layout, .mainmenu-mini-windows.tiny-layout {
	position: static;
	left: 0;
	top: 0;
	width: auto;
	min-height: auto;
}
.mainmenu-mini-windows.tiny-layout {
	padding-bottom: 0;
}
.tiny-layout .mainmenu-left, .tiny-layout .mainmenu-right {
	width: auto;
}
.tiny-layout .mainmenu-footer {
	position: static;
}

@media (max-width:1087px) {
	.mainmenu-left {
		padding-bottom: 0;
	}
	.mainmenu-right {
		position: static;
		top: 0;
		padding-bottom: 51px;
	}
}

.battleform {
	width: 230px;
	text-align: left;
	margin: 0 auto;
}
.battleform .buttonbar {
	text-align: center;
}

.mini-window {
	margin: 0 auto 12px;
	width: 312px;
}
.mini-window-header {
	background: rgba(248,248,248,.8);
	color: #777777;
	margin: 0;
	padding: 2px 3px 2px 5px;
	font-size: 11pt;
	border: 1px solid #AAAAAA;
	border-top-left-radius: 5px;
	border-top-right-radius: 5px;
	cursor: pointer;
}
.mini-window-header:hover {
	color: #333333;
}
.mini-window.collapsed .mini-window-header {
	border-radius: 5px;
}
.mini-window-header.notifying {
	border-color: #AA8866;
	background: #E3C3A3;
}
.dark .mini-window-header.notifying {
	background: #417589;
	color: #BBBBBB;
}
.mini-window-header.notifying:hover {
	border-color: #604020;
	background: #CFAF8F;
}
.dark .mini-window-header.notifying:hover {
	background: #417589;
}
.mini-window-header .closebutton,
.mini-window-header .maximizebutton,
.mini-window-header .minimizebutton {
	float: right;
	margin: -2px -4px 0 0;
	width: 22px;
	height: 21px;
	font-size: 16px;
}
.mini-window-header small {
	color: #888888;
	font-weight: normal;
	vertical-align: 1px;
}
.mini-window .mini-window-contents {
	position: relative;
	height: 500px;
	border: 1px solid #AAAAAA;
	border-top: 0;
	border-bottom-left-radius: 5px;
	border-bottom-right-radius: 5px;
}
.mini-window .mini-window-contents.mini-window-flex {
	height: auto;
}
.mini-window-body {
	min-height: 100px;
	max-height: 300px;
	background: rgba(242,247,250,.925);
	color: black;
	word-wrap: break-word;
	border: 1px solid #AAAAAA;
	border-top: 0;
	border-bottom-left-radius: 5px;
	border-bottom-right-radius: 5px;
}
.dark .mini-window-body {
	background: rgba(0,0,0,.9);
	color: #DDD;
	backdrop-filter: blur(4px);
}
.pm-buttonbar {
	padding-bottom: 3px;
}
.mini-window.collapsed .mini-window-contents,
.mini-window.collapsed .mini-window-body {
	display: none;
}
.mini-window.focused .mini-window-header,
.mini-window.focused .mini-window-contents,
.mini-window.focused .mini-window-body {
	border-color: #555555;
}
.dark .mini-window.focused .mini-window-header,
.dark .mini-window.focused .mini-window-body,
.dark .mini-window.focused .mini-window-contents {
	border-color: #CCC;
}
.mini-window.focused .mini-window-header,
.mini-window.focused .mini-window-header:hover {
	background: #f8f8f8;
	color: #222222;
}
.dark .mini-window-header {
	background: rgba(50,50,50,.8);
	color: #AAA;
}
.dark .mini-window-header:hover {
	color: #CCC;
}
.dark .mini-window.focused .mini-window-header,
.dark .mini-window.focused .mini-window-header:hover {
	background: #222;
	color: #EEE;
}

.challenge {
	margin: 0 5px 5px;
	border: 1px solid #f57b21;
	background: #fcd2b3;
	color: #682f05;
	border-radius: 5px;
	padding: 1px 5px;
}
.dark .challenge {
	background: #682f05;
	color: #fcd2b3;
}
.challenge.outgoing {
	border: 1px solid #217bf5;
	background: #b3d2fc;
	color: #052f68;
}
.dark .challenge.outgoing {
	background: #052f68;
	color: #b3d2fc;
}
.fieldset {
	border: 1px solid #888;
	border-radius: 5px;
}
.challenge.outgoing .fieldset {
	border-color: #217bf5;
}
.challenge p {
	margin: 4px 0;
}
.newsentry {
	font-size: 9pt;
	padding: 1px 10px;
}
.newsentry + .newsentry {
	border-top: 1px solid #AAAAAA;
}
.unread {
	background: rgba(255,240,130,0.33);
}

.mainmessage {
	display: block;
	padding: 10px 15px;
	margin: 30px 40px;
	max-width: 400px;
	border-radius: 20px;

	background: rgba(201, 207, 219, .8);
	color: black;
}
.menugroup {
	display: block;
	padding: 10px 0;
	margin: 0 auto 30px auto;
	max-width: 250px;
	border-radius: 20px;

	background: rgba(0,0,0,.2);
	backdrop-filter: blur(4px);
	color: white;
	text-shadow: 0 1px 0 black;
	text-align: center;
}
form.menugroup {
	max-width: 270px;
}
.menugroup .label, .tournament-tools .label {
	text-align: left;
	width: 246px;
	margin: 0 auto;
}

.mainmessage p,
.menugroup p {
	margin: 10px 0;
}
.mainmenu.button {
	box-sizing: border-box;
	font-size: 12pt;

	display: inline-block;
	padding: 5px 7px 3px 7px;

	width: 200px;

	text-shadow: 0 -1px 0 hsl(210,40%,10%);
	box-shadow: 0 1px 2px rgba(0,0,0,.2), inset 0 1px 1px rgba(255,255,255,.8);

	/* default colors */
	color: #FFFFFF;
	border: solid 1px #AAAAAA;
	background: #779EC5;
	background: hsl(210,40%,62%);
	background: linear-gradient(to bottom,  hsl(210,40%,72%),  hsl(210,40%,52%));
	border-color: hsl(210,40%,40%);
}
.mainmenu.button.big {
	width: 230px;
	height: 50px;
	padding: 0;
	font-size: 14pt;
}
.mainmenu.button.big small {
	display: block;
	font-size: 9pt;
}
.mainmenu.button:hover {
	background: #5485B6;
	background: hsl(210,40%,52%);
	background: linear-gradient(to bottom,  hsl(210,40%,62%),  hsl(210,40%,42%));
	border-color: hsl(210,40%,21%);
}
.mainmenu.button:active {
	box-shadow: 0 1px 2px rgba(0,0,0,.2), inset 0 -1px 1px rgba(255,255,255,.3), inset 0 1px 1px rgba(0,0,0,.4);
	background: #406B96;
	background: hsl(210,40%,42%);
	background: linear-gradient(to bottom,  hsl(210,40%,42%),  hsl(210,40%,58%));
	border-color: hsl(210,40%,21%);
}
.mainmenu.button.disabled,
.mainmenu.button.disabled:hover,
.mainmenu.button.disabled:active {
	cursor: default;
	background: #EEEEEE;
	border-color: #CCCCCC;
	border-style: solid;
	border-width: 1px;
	color: #999999;
	text-shadow: none;
	box-shadow: 0 1px 2px rgba(0,0,0,.1);
}

.button.mainmenu1 { background: linear-gradient(to bottom,  hsl(5,40%,72%),  hsl(5,40%,52%)); border-color: hsl(5,40%,40%); }
.button.mainmenu1:hover { background: linear-gradient(to bottom,  hsl(5,40%,62%),  hsl(5,40%,42%)); }
.button.mainmenu1:active { background: linear-gradient(to bottom,  hsl(5,40%,42%),  hsl(5,40%,58%)); }

.button.mainmenu2 { background: linear-gradient(to bottom,  hsl(30,40%,72%),  hsl(30,40%,52%)); border-color: hsl(30,40%,40%); }
.button.mainmenu2:hover { background: linear-gradient(to bottom,  hsl(30,40%,62%),  hsl(30,40%,42%)); }
.button.mainmenu2:active { background: linear-gradient(to bottom,  hsl(30,40%,42%),  hsl(30,40%,58%)); }

.button.mainmenu3 { background: linear-gradient(to bottom,  hsl(60,40%,62%),  hsl(60,40%,42%)); border-color: hsl(60,40%,40%); }
.button.mainmenu3:hover { background: linear-gradient(to bottom,  hsl(60,40%,52%),  hsl(60,40%,32%)); }
.button.mainmenu3:active { background: linear-gradient(to bottom,  hsl(60,40%,32%),  hsl(60,40%,48%)); }

.button.mainmenu4 { background: linear-gradient(to bottom,  hsl(130,40%,72%),  hsl(130,40%,52%)); border-color: hsl(130,40%,40%); }
.button.mainmenu4:hover { background: linear-gradient(to bottom,  hsl(130,40%,62%),  hsl(130,40%,42%)); }
.button.mainmenu4:active { background: linear-gradient(to bottom,  hsl(130,40%,42%),  hsl(130,40%,58%)); }

.button.mainmenu5 { background: linear-gradient(to bottom,  hsl(210,40%,72%),  hsl(210,40%,52%)); border-color: hsl(210,40%,40%); }
.button.mainmenu5:hover { background: linear-gradient(to bottom,  hsl(210,40%,62%),  hsl(210,40%,42%)); }
.button.mainmenu5:active { background: linear-gradient(to bottom,  hsl(210,40%,42%),  hsl(210,40%,58%)); }

.button.mainmenu6 { background: linear-gradient(to bottom,  hsl(270,40%,72%),  hsl(270,40%,52%)); border-color: hsl(270,40%,40%); }
.button.mainmenu6:hover { background: linear-gradient(to bottom,  hsl(270,40%,62%),  hsl(270,40%,42%)); }
.button.mainmenu6:active { background: linear-gradient(to bottom,  hsl(270,40%,42%),  hsl(300,40%,58%)); }

#ps-debug-menu {
	display: none;
	position: fixed;
	left: 8px;
	bottom: 8px;
	z-index: 9999;
	margin: 0;
	padding: 6px 8px;
	background: rgba(0,0,0,.75);
	color: white;
	font: 11px/1.35 monospace;
	pointer-events: none;
	white-space: pre-wrap;
	border-radius: 4px;
}

/*********************************************************
 * User menu
 *********************************************************/

/*********************************************************
 * Room list
 *********************************************************/

.roomcounters {
	max-width: 480px;
	margin: 8px 0 15px 0;
	text-align: center;
}
@media (max-width: 382px) {
	.roomcounters {
		margin: 38px 0 15px 0;
	}
}
.roomcounters .button {
	margin: 0 auto;
	width: 118px;
	height: 52px;
	padding: 6px 0 0 0;
	text-align: center;
	vertical-align: middle;
	font-size: 10pt;
	position: relative;
}
.roomcounters .button strong {
	display: block;
	font-size: 18pt;
	font-weight: normal;
}
.roomcounters .usercount {
	display: block;
	width: 49px;
	height: 63px;
	position: absolute;
	left: -30px;
	bottom: -5px;
	background: url(https://play.pokemonshowdown.com/sprites/gen5/meloetta.png) center no-repeat;
}
.roomcounters .button:hover .usercount {
	background: url(https://play.pokemonshowdown.com/sprites/gen5ani/meloetta.gif) center no-repeat;
}
.roomcounters .usercount.afd,
.roomcounters .button:hover .usercount.afd {
	background: url(https://play.pokemonshowdown.com/sprites/afd/meloetta.png) center no-repeat;
}
.roomcounters .battlecount {
	display: block;
	width: 46px;
	height: 76px;
	position: absolute;
	right: -30px;
	bottom: -10px;
	background: url(https://play.pokemonshowdown.com/sprites/gen5/meloetta-pirouette.png) center no-repeat;
}
.roomcounters .button:hover .battlecount {
	background: url(https://play.pokemonshowdown.com/sprites/gen5ani/meloetta-pirouette.gif) center no-repeat;
}
.roomcounters .battlecount.afd,
.roomcounters .button:hover .battlecount.afd {
	background: url(https://play.pokemonshowdown.com/sprites/afd/meloetta-pirouette.png) center no-repeat;
}

.roomlist {
	max-width: 480px;
	text-align: left;
	list-style: none;
	margin: 0;
	padding: 0;
}
.roomlist .subrooms {
	font-size: 8pt;
	padding-left: 20px;
	margin: -5px 0 4px;
}
.roomlist .subrooms i.fa-level-up {
	margin-right: 5px;
}
.roomlist .subrooms a.blocklink {
	display: inline-block;
	margin: 0;
	vertical-align: middle;
	font-size: 8pt;
}

/*********************************************************
 * Chat
 *********************************************************/

.chat-log {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 40px;
	font-size: 10pt;
	word-wrap: break-word;

	overflow: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
}
.chat-log, .readable-bg, .battle-log {
	background: rgba(242,247,250,.5);
	color: black;
}
.dark .chat-log, .dark .readable-bg, .dark .battle-log {
	background: rgba(0,0,0,.5);
	color: #DDD;
	backdrop-filter: blur(4px);
}
.chat-log-add {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	min-height: 36px;
	padding: 3px 4px 0 4px;
	border-top: 1px solid #AAAAAA;
}
.battle-log .chat-log-add {
	position: static;
	border-bottom: 1px solid #AAAAAA;
}
.mini-window-flex .chat-log, .mini-window-flex .chat-log-add {
	position: static;
}
.mini-window-flex .chat-log {
	min-height: 80px;
	max-height: 300px;
}
.mini-window-flex .chat-log.challenge-open {
	max-height: 520px;
}
.debug {
	display: none;
}
.chat.highlighted {
	margin-left: -8px;
	margin-right: -8px;
	padding-left: 8px;
	padding-right: 8px;
}
.revealed {
	background-color: #C8FDEA;
}
.dark .revealed {
	background: rgba(0,255,200,0.18);
}
.message-pm {
	color: #007100;
}
.dark .message-pm {
	color: #00af00;
}
.message-pm .pmnote {
	cursor: pointer;
}
.chat-log .inner,
.pm-log .inner {
	padding: 24px 8px 6px 8px;
}

.chatbox {
	margin: 0 2px 0 80px;
	padding: 5px 0 0 0;
}
.chatbox.nolabel {
	margin: 0 4px 0 4px;
	padding: 5px 0 5px 0;
}
.chatbox label {
	float: left;
	margin-left: -78px;
	padding-top: 2px;
	width: 73px;
	text-align: right;
	overflow: hidden;
	white-space: pre;

	font-weight: bold;
	font-size: 8pt;
}
.chatbox.nolabel label {
	display: none;
}
.chatbox .textbox {
	overflow-x: hidden;
}
.chatbox pre.textbox {
	margin: 0;
	height: auto;
	overflow-wrap: break-word;
}
pre.textbox.textbox-empty[placeholder]:before {
	content: attr(placeholder);
	color: #777;
	position: absolute;
	cursor: text;
	white-space: nowrap;
}

/* Tournaments */

.tournaments-info > ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tournament-wrapper {
	display: none;
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 30px;
	line-height: 30px;
	text-align: center;
	border-bottom: 1px #aaa solid;
}
.tournament-wrapper.active {
	display: block;
}

.tournament-title {
	display: block;
	cursor: pointer;
	font: inherit;
	font-weight: bold;
	height: 30px;
	border: 0;
	padding: 0;
	background: transparent;
	width: 100%;
	text-align: center;
	overflow: hidden;
	white-space: nowrap;
}
.tournament-title:hover {
	background: rgba(242, 247, 250, 0.85);
}
.dark .tournament-title:hover {
	background: rgba(50, 50, 50, 0.85);
}
.tournament-title i.fa {
	float: right;
	line-height: 30px;
	padding-right: 5px;
}

.tournament-status {
	background: rgba(242, 247, 250, 0.85);
	border-right: 1px #aaa solid;
	padding: 0 5px;
	margin-right: 5px;
	line-height: 30px;
	font-weight: normal;
	float: left;
	font-size: 11px;
}

.tournament-box {
	position: absolute;
	top: 2em;
	left: 0;
	right: 0;
	z-index: 1;
	line-height: 1em;
	border-bottom: 1px #aaa solid;
	border-right: 1px #aaa solid;
	background-color: rgba(242, 247, 250, 0.85);
	overflow: auto;
  transform-origin: top;
	transform: scaleY(0);
	touch-action: none;
	transition: transform 0.15s ease-out;
}
.tournament-box.active {
	transform: scaleY(1);
	transition: transform 0.15s ease-out;
}

.tournament-bracket {
	max-height: 200px;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	font-size: 8pt;
}

.tournament-popout-link {
	position: absolute;
	bottom: 0.5em;
	right: 0.5em;
}
.tournament-close-link {
	position: absolute;
	top: 0.5em;
	right: 0.5em;
}
.tournament-popout-bracket {
	width: 100%;
	height: 100%;
	max-height: 90vh;
}

.tournament-bracket-table {
	margin: 0 auto;
	empty-cells: hide;
	border-bottom: 1px #aaa solid;
	border-collapse: collapse;
}
.tournament-bracket-table td, .tournament-bracket-table th {
	border: 1px #aaa solid;
	padding: 5px;
}
.tournament-bracket-table td {
	white-space: nowrap;
}
.tournament-bracket-table .empty,
.tournament-bracket-table .tournament-bracket-table-cell-null {
	border-width: 0;
}
.tournament-bracket-table-cell-result-win {
	background-color: rgba(128, 196, 128, 0.7);
	color: black;
}
.tournament-bracket-table-cell-result-draw {
	background-color: rgba(255, 196, 128, 0.7);
	color: black;
}
.tournament-bracket-table-cell-result-loss {
	background-color: rgba(255, 128, 128, 0.7);
	color: black;
}

.tournament-bracket-tree {
	text-align: center;
}
.tournament-bracket-tree-link {
	fill: none;
	stroke: #aaa;
}
.tournament-bracket-tree-link-active {
	stroke: #aa0;
	stroke-width: 3px;
}
.tournament-bracket-tree-abbreviated {
	fill: #999;
}
.tournament-bracket-tree-node rect {
	/* Note: Due to SVG limitations, dimensions and border radii are in client-chat-tournament.js (nodeSize) */
	fill: rgba(178, 194, 210, 0.7);
	stroke: rgba(74, 77, 80, 0.7);
	color: black;
}
.tournament-bracket-tree-node a rect {
	fill: hsla(219, 93%, 77%, 0.7);
	stroke: hsla(219, 100%, 25%, 0.7);
	color: black;
}
.tournament-bracket-tree-node a:hover rect {
	fill: hsla(218, 38%, 82%, 0.7);
	stroke: hsla(219, 68%, 35%, 0.7);
	color: black;
}
.tournament-bracket-tree-node-match-available rect,
.tournament-bracket-tree-node-match-challenging rect {
	fill: hsla(294, 36%, 71%, 0.7);
	stroke: hsla(294, 68%, 35%, 0.7);
	color: black;
}
.tournament-bracket-tree-node rect.tournament-bracket-tree-win {
	fill: rgba(128, 196, 128, 0.7);
	stroke: rgba(0, 128, 0, 0.7);
	color: black;
}
.tournament-bracket-tree-node rect.tournament-bracket-tree-loss,
.tournament-bracket-tree-node rect.tournament-bracket-tree-draw {
	fill: hsla(219, 0%, 71%, 0.7);
	stroke: hsla(219, 0%, 35%, 0.7);
	color: black;
}
.tournament-bracket-tree-node text, .tournament-bracket-tree-node {
	font-size: 8.5pt;
	text-anchor: middle;
	font-weight: bold;
}
.tournament-bracket-tree-node a {
	color: #248;
}
.tournament-bracket-tree-node a text, .tournament-bracket-tree-node a:hover text {
	fill: #248;
}
.tournament-bracket-tree-team-win {
	font-weight: bold;
}
.tournament-bracket-tree-team-loss, .tournament-bracket-tree-team-draw, .tournament-bracket-tree-score {
	font-weight: normal;
}

.tournament-tools {
	padding: 1px 10px;
	border-top: 1px #aaa solid;
}
.tournament-tools p {
	margin: 0.5em 0;
}
.tournament-team {
	padding-bottom: 5px;
}
.tournament-challenge-user,
.tournament-challenged-message,
.tournament-challenging-message,
.tournament-challengeby {
	font-size: 9pt;
	padding-bottom: 5px;
}
.tournament-tools .button {
	font-size: 9pt;
}

.tournament-message-create,
.tournament-message-start,
.tournament-message-forceend,
.tournament-message-end-winner {
	font-weight: bold;
}
.tournament-message-end-bracket {
	font-weight: normal !important;
	max-height: 400px;
	overflow: hidden;
	text-align: center;
}

/* Userlist */

.userlist {
	display: block;
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 145px;
	height: auto;

	overflow: auto;
	-webkit-overflow-scrolling: touch;
}
.userlist-hidden {
	width: auto;
	border-right: 0;
	bottom: auto;
	overflow: visible;
}
.userlist-hidden .button.button-middle {
	margin: -1px -1px 0 0;
}
.userlist-static {
	position: static;
	border-right: 0;
}
.userlist-count {
	text-align: center;
	padding: 2px 0;
}
.chat-log.hasuserlist,
.tournament-wrapper.hasuserlist {
	left: 146px;
}
.chat-log.hasuserlist {
	border-left: 1px solid #AAAAAA;
}
.userlist ul,
.userlist li {
	display: block;
	list-style-type: none;
	margin: 0;
	padding: 0;
	text-align: left;
}
.userlist-hidden ul {
	display: none;
}
.userlist li {
	font: 10pt Verdana, sans-serif;
	white-space: nowrap;
}
.userlist li em.group {
	font-style: normal;
	font-size: 8pt;
	color: #AAAAAA;
	display: block;
	float: left;
	text-align: center;
	padding: 1px 0 0 1px;
	width: 14px;
}
.userlist li button {
	box-sizing: border-box;
	display: block;
	overflow: hidden;
	height: auto;
	background: transparent;
	border: 0;
	padding: 1px 0;
	margin: 0;
	height: 21px;
	width: 100%;
	white-space: nowrap;
	font: 9pt Verdana, sans-serif;
	text-align: left;
}
/* Remove Firefox's magic padding */
.userlist li button::-moz-focus-inner {
	padding: 0;
}
.userlist li button:hover {
	background: #dce4ec;
}
.dark .userlist li button:hover {
	background: #222222;
}
.userlist li button:active {
	background: #ccd4dc;
}
.dark .userlist li button:active {
	background: black;
}
.userlist li.cur {
	background: white;
}
.userlist li.cur button,
.userlist li.cur button:hover {
	background: white;
	margin: 0 0 0 -1px;
}

@media (min-width: 500px) {
	html:not(.native-scrollbars) *::-webkit-scrollbar {
		-webkit-appearance: none
	}
	html:not(.native-scrollbars) *::-webkit-scrollbar:vertical {
		width: 16px
	}
	html:not(.native-scrollbars) *::-webkit-scrollbar:horizontal {
		height: 16px
	}
	html:not(.native-scrollbars) *::-webkit-scrollbar-button,html:not(.native-scrollbars) *::-webkit-scrollbar-corner {
		display: none
	}
	html:not(.native-scrollbars) *::-webkit-scrollbar-track {
		background: transparent;
		border: 1px solid transparent;
	}
	html:not(.native-scrollbars) *::-webkit-scrollbar-track:hover {
		background: #c5cbce;
		border-color: #959595;
	}
	html:not(.native-scrollbars) *::-webkit-scrollbar-track:vertical {
		border-width: 0 0 0 1px;
	}
	html:not(.native-scrollbars) *::-webkit-scrollbar-track:vertical:corner-present {
		border-width: 0 0 1px 1px;
		border-radius: 0 0 0 2px;
	}
	html:not(.native-scrollbars) *::-webkit-scrollbar-track:horizontal {
		border-width: 1px 1px 0 1px;
		border-radius: 2px 2px 0 0;
	}
	html:not(.native-scrollbars) *::-webkit-scrollbar-thumb {
		min-height: 2rem;
		background: #acaeaf;
		background-clip: padding-box;
		border: 5px solid transparent;
		border-radius: 10px;
	}
	html:not(.native-scrollbars) *::-webkit-scrollbar-thumb:hover,html:not(.native-scrollbars) *::-webkit-scrollbar-thumb:active {
		background-color: #6c6c6f;
		border-width: 4px;
	}

	html.dark:not(.native-scrollbars) *::-webkit-scrollbar-track:hover {
		background: #24282a;
		border-color: #000000;
	}
	html.dark:not(.native-scrollbars) *::-webkit-scrollbar-thumb {
		background: #6c6c6f;
	}
	html.dark:not(.native-scrollbars) *::-webkit-scrollbar-thumb:hover,html.dark:not(.native-scrollbars) *::-webkit-scrollbar-thumb:active {
		background-color: #949697;
	}
}

/*********************************************************
 * Battle
 *********************************************************/

.ps-room .battle-userlist {
	left: 641px;
}
.ps-room .battle-log {
	position: absolute;
	top: 0;
	left: 640px;
	right: 0;
	bottom: 40px;
	height: auto;
	width: auto;

	word-wrap: break-word;
	border-right: 0;
	border-top: 0;
	border-bottom: 0;
}
.ps-room .battle-log .inner {
	padding-top: 25px;
}

/* I like this one (bottom-aligns chat logs) but it's controversial */
/* .battle-log, .chat-log {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
} */

/* these two bottom-align controls in the mobile UI, while leaving everything else at the top */
.battle-log {
	display: flex;
	flex-direction: column;
}
.battle-log .inner-preempt {
	flex-grow: 1;
}

.ps-room .battle-log-add {
	position: absolute;
	bottom: 0;
	left: 640px;
	right: 0;
	top: auto;
	min-height: 36px;
	height: auto;
	width: auto;

	padding: 3px 4px 0 4px;
	border-right: 0;
	border-bottom: 0;
}
.ps-room .battle {
	border-top: 0;
	border-left: 0;
	border-right: 0;
	top: 0;
	left: 0;
	transform-origin: top left;
	-webkit-transform-origin: top left;
}
.ps-room .foehint {
	transform-origin: top left;
	-webkit-transform-origin: top left;
}
.battle-controls {
	position: absolute;
	top: 370px;
	left: 0;
	width: 640px;
}
.battle-log .battle-controls {
	top: 0;
	position: static;
	width: auto;
}
.battle-log .inline-controls {
	padding-bottom: 20px;
	padding-top: 4px;
	margin-top: 4px;
	border-top: 1px solid #AAA;
}
.inline-battle .inline-controls {
	margin-top: 0;
}
.battle-log .battle {
	border-bottom: 0;
}
.movecontrols, .switchcontrols {
	max-width: 330px;
	margin: 0 auto;
}
.wide-controls .movecontrols, .wide-controls .switchcontrols {
	max-width: 650px;
}
.scrollable-battle-container {
	overflow: auto;
	overflow-x: hidden;
	scrollbar-width: thin;
	height: auto;
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 640px;
}
.timerbutton {
	float: right;
}
.timerbutton-on,
.timerbutton-on:hover {
	color: #992222;
	border-color: #992222;
}
.timerbutton-on:hover {
	border-color: #661111;
}
.timerbutton-critical,
.timerbutton-critical:hover {
	color: #ffffff;
	font-weight: bold;
	border-color: #BB2222;
	background: #BB2222;
	text-shadow: none;
}
.dark .timerbutton-on,
.dark .timerbutton-on:hover {
	color: #EE6666;
	border-color: #EE6666;
}
.dark .timerbutton-critical,
.dark .timerbutton-critical:hover {
	color: #ffffff;
	font-weight: bold;
	border-color: #BB2222;
	background: #BB2222;
	text-shadow: none;
}

.battle-controls p {
	margin: 2px 0 8px 0;
	padding: 0 8px;
}
.battle-chat-toggle {
	position: absolute;
	top: 4px;
	left: 168px;
	font-size: 14px;
	padding: 3px 6px;
}
.battle-chat-toggle[name=showChat] {
	left: auto;
	right: 6px;
}

/*********************************************************
 * Player controls
 *********************************************************/

.battle-controls .whatdo {
	margin-top: -2px;
	padding: 0 8px;
	font-size: 9pt;
	line-height: 2;
	color: #555555;
}
.dark .battle-controls .whatdo {
	color: #999999;
}
.battle-controls .whatdo small {
	padding: 1px 2px;
	border: 1px solid #999999;
	border-radius: 4px;
}
.battle-controls .whatdo small.weak {
	color: #AAAA22;
	border-color: #AAAA22;
}
.battle-controls .whatdo small.critical {
	color: #EE4433;
	border-color: #EE4433;
}

.shiftselect,
.moveselect,
.switchselect {
	font-weight: bold;
	font-style: italic;
	color: #555555;
	font-size: 12pt;
	margin: 0;
	padding: 9px 7px 0 7px;
}
.moveselect {
	color: #884422;
}
.switchselect, .shiftselect {
	color: #445588;
}
.dark .moveselect {
	color: #e48d61;
}
.dark .switchselect, .dark .shiftselect {
	color: #7c94dd;
}
.switchmenu button {
	position: relative;
	display: block;
	float: left;
	width: 102px;
	min-height: 30px;
	margin-right: 4px;
	font: 9pt Verdana, sans-serif;
	padding: 5px 5px 5px 0;
	white-space: pre;
	overflow: hidden;
}
.switchmenu button .picon {
	float: left;
	margin: -6px -3px -6px -4px;
	opacity: 0.8;
}
.switchmenu button .hpbar {
	position: absolute;
	display: block;
	border: 1px solid #AAA;
	background: #EEE;
	height: 2px;
	bottom: 2px; left: 4px; right: 2px;
	border-radius: 2px;
	opacity: .8;
}

/* The declaration order of these three hpbar* classes is significant. */

.switchmenu button .hpbar span {
	display: block;
	height: 1px;
	background: #0A6;
	border-top: 1px solid #3C0;
	border-radius: 1px;
}
.switchmenu button .hpbar-yellow span {
	border-top-color: #a5aa53;
	background-color: #a2a822;
}
.switchmenu button .hpbar-red span {
	border-top-color: #faa;
	background-color: #f55;
}

/****************/

.switchmenu button .status {
	position: absolute;
	display: block;
	right: 2px;
	bottom: 1px;
	width: 5px;
	height: 5px;
	padding: 0;
	border-radius: 2px;
	border: 1px solid #C2C2C2;
	opacity: 1.0;
}
.status {
	color: white;
	border-radius: 3px;
	padding: 0 2px;
}
.status.brn {
	background: #EE5533;
}
.status.psn, .status.tox {
	background: #A4009A;
}
.status.par {
	background: #9AA400;
}
.status.slp {
	background: #AA77AA;
}
.status.frz {
	background: #009AA4;
}

.has-tooltip {
	-webkit-touch-callout: none;
	user-select: none;
	-webkit-user-select: none;
}
.movebutton {
	float: left;
	display: block;
	width: 155px;
	margin-right: 4px;
	height: 40px;
	font: 10pt/100% Verdana, sans-serif;
	position: relative;
	padding:  6px 4px 0 4px;
}
.movebutton small {
	color: #777777;
}
.movebutton small.type {
	padding-top: 3px;
	float: left;
	font-size: 8pt;
}
.movebutton small.pp {
	padding-top: 2px;
	float: right;
	font-size: 8pt;
}
.megaevo-box {
	clear: both;
	padding-top: 10px;
	padding-right: 14px;
	text-align: center;
}
.megaevo {
	clear: both;
	display: block;
	width: 180px;
	margin: 0 auto 0;
	padding: 2px;
	line-height: 1em;
	text-align: center;

	cursor: pointer;
	border: 1px solid #BBB;
	border-radius: 3px;
	background: transparent;
	font-size: 10pt;
	font-weight: bold;
}
.megaevo:hover {
	border-color: #888;
	background: #E5E5E5;
	color: black;
}
.dark .megaevo {
	color: #EEE;
	border-color: #888;
}
.dark .megaevo:hover {
	color: #FFF;
	background: #333;
	border-color: #BBB;
}
.megaevo:has(:checked),
.dark .megaevo:has(:checked) {
	text-shadow: -1px -1px 0 #FFF, 1px 1px 0 #FFF, -1px 1px 0 #FFF, 1px -1px 0 #FFF;
	color: black;
  background-image: linear-gradient(120deg,
		hsl(0, 100%, 75%) 0%,
		hsl(36, 100%, 75%) 10%,
		hsl(64, 100%, 75%) 20%,
		hsl(118, 100%, 83%) 30%,
		hsl(179, 100%, 80%) 40%,
		hsl(188, 100%, 79%) 50%,
		hsl(212, 100%, 77%) 60%,
		hsl(260, 100%, 77%) 70%,
		hsl(284, 100%, 76%) 80%,
		hsl(308, 100%, 76%) 90%,
		hsl(0, 100%, 75%) 100%
	);
}
.megaevo input {
	width: 16px;
	height: 16px;
	vertical-align: -3px;
	cursor: pointer;
}
.megaevo .typeicon {
	vertical-align: 2px;
}

.switchmenu,
.movemenu {
	display: block;
	margin-right: -10px;
	padding-left: 4px;
}
.switchmenu:after {
	content: '';
	display: block;
	clear: both;
}
.switchmenu button,
.movebutton {
	position: relative;
	outline: none;
	text-align: center;
	text-decoration: none;
	text-shadow: 0 1px 0 rgba(255,255,255,.4);
	border-radius: 5px;
	margin-top: 4px;
	box-shadow: 0 1px 2px rgba(0,0,0,.2), inset 0 -1px 2px rgba(255,255,255,1);

	/* default colors */
	color: #000000;
	border: solid 1px #AAAAAA;
	background: #e3e3e3;
	background: linear-gradient(to bottom,  #f6f6f6,  #e3e3e3);
}
.switchmenu button:hover,
.movebutton:hover {
	background: #cfcfcf;
	background: linear-gradient(to bottom,  #f2f2f2,  #cfcfcf);
	border-color: #606060;
}
.switchmenu button:active,
.movebutton:active,
.switchmenu button.pressed,
.movebutton.pressed {
	background: linear-gradient(to bottom,  #cfcfcf,  #f2f2f2);
}

.switchmenu button.disabled,
.switchmenu button:disabled,
.movebutton.disabled,
.movebutton:disabled {
	cursor: default;
	background: #F3F3F3 !important;
	border-color: #CCCCCC !important;
	-webkit-box-shadow: none !important;
	-moz-box-shadow: none !important;
	box-shadow: none !important;
	color: #707070 !important;
	opacity: 0.75;
}

/*********************************************************
 * Overlay player controls
 *********************************************************/

.overlay-controls-list,
.overlay-controls .movecontrols,
.overlay-controls .switchcontrols,
.overlay-controls .targetcontrols,
.overlay-controls .teamcontrols,
.overlay-controls .whatdo {
	background: black;
	background: rgba(0,0,0,.6);
	backdrop-filter: blur(8px);
	border-radius: 12px;
	color: white;
}

.overlay-controls-skip {
	position: absolute;
	right: 5px;
	bottom: 5px;
}

.overlay-controls-list {
	width: 100px;

	position: absolute;
	right: 5px;
	bottom: 5px;
}
.overlay-controls-list .button {
	display: block;
	width: 80px;
	margin: 10px auto;
	font-size: 16px;
	font-style: italic;
	padding: 4px 0;
}
/* doubled to fight the specificity of .dark .button:hover */
.overlay-controls-list.overlay-controls-list .move-button,
.overlay-controls-list.overlay-controls-list .move-button.cur {
	color: #FFFFFF;
	text-shadow: 0 -1px 0 hsl(20,60%,10%);
	background: #884422;
	background: linear-gradient(to bottom, hsl(20,60%,62%), hsl(20,60%,47%));
	border-color: hsl(20,60%,37%);
	box-shadow: 0 1px 2px rgba(0,0,0,.2), inset 0 1px 1px rgba(255,255,255,.3);
}
.overlay-controls-list.overlay-controls-list .move-button:hover {
	color: #FFFFFF;
	background: linear-gradient(to bottom, hsl(20,60%,57%), hsl(20,60%,42%));
	border-color: hsl(20,60%,31%);
}
.overlay-controls-list.overlay-controls-list .move-button:active,
.overlay-controls-list.overlay-controls-list .move-button.cur:active {
	background: linear-gradient(to bottom, hsl(20,60%,42%), hsl(20,60%,59%));
	box-shadow: 0 1px 2px rgba(0,0,0,.2), inset 0 -1px 1px rgba(255,255,255,.2), inset 0 1px 1px rgba(0,0,0,.4);
}
.overlay-controls-list.overlay-controls-list .switch-button,
.overlay-controls-list.overlay-controls-list .switch-button.cur,
.overlay-controls-list.overlay-controls-list .shift-button,
.overlay-controls-list.overlay-controls-list .shift-button.cur {
	color: #FFFFFF;
	text-shadow: 0 -1px 0 hsl(228,33%,10%);
	background: #445588;
	background: linear-gradient(to bottom, hsl(228,33%,62%), hsl(228,33%,47%));
	border-color: hsl(228,33%,37%);
	box-shadow: 0 1px 2px rgba(0,0,0,.2), inset 0 1px 1px rgba(255,255,255,.3);
}
.overlay-controls-list.overlay-controls-list .switch-button:hover,
.overlay-controls-list.overlay-controls-list .shift-button:hover {
	color: #FFFFFF;
	background: linear-gradient(to bottom, hsl(228,33%,57%), hsl(228,33%,42%));
	border-color: hsl(228,33%,31%);
}
.overlay-controls-list.overlay-controls-list .switch-button:active,
.overlay-controls-list.overlay-controls-list .switch-button.cur:active,
.overlay-controls-list.overlay-controls-list .shift-button:active,
.overlay-controls-list.overlay-controls-list .shift-button.cur:active {
	background: linear-gradient(to bottom, hsl(228,33%,42%), hsl(228,33%,59%));
	box-shadow: 0 1px 2px rgba(0,0,0,.2), inset 0 -1px 1px rgba(255,255,255,.2), inset 0 1px 1px rgba(0,0,0,.4);
}
.overlay-controls-list.overlay-controls-list .button.cur {
	box-shadow: 0 1px 2px rgba(0,0,0,.2), inset 0 0 0 2px rgba(255,255,255,.35), inset 0 -1px 1px rgba(255,255,255,.2), inset 0 1px 1px rgba(0,0,0,.4);
}
.overlay-controls-list.overlay-controls-list .move-button.cur {
	background: linear-gradient(to bottom, hsl(20,60%,42%), hsl(20,60%,59%));
}
.overlay-controls-list.overlay-controls-list .switch-button.cur,
.overlay-controls-list.overlay-controls-list .shift-button.cur {
	background: linear-gradient(to bottom, hsl(228,33%,42%), hsl(228,33%,59%));
}
.overlay-controls-list.overlay-controls-list .button.disabled {
	color: #999;
	text-shadow: none;
	background: #EEEEEE;
	border-color: #CCCCCC;
	box-shadow: 0 1px 2px rgba(0,0,0,.1);
	opacity: .5;
}

.overlay-controls .movecontrols,
.overlay-controls .switchcontrols,
.overlay-controls .targetcontrols,
.overlay-controls .teamcontrols,
.overlay-controls .whatdo {
	position: absolute;
	right: 110px;
	bottom: 5px;
	width: 172px;
	padding: 10px 0 10px 9px;
}
.overlay-controls .switchcontrols {
	width: 119px;
}
.overlay-controls .targetcontrols,
.overlay-controls .teamcontrols {
	width: 225px;
}
.overlay-controls .overlay-message {
	margin: 0 0 6px 0;
	padding-right: 9px;
	font-size: 9pt;
	line-height: 1.4;
}
.overlay-controls .switchselect,
.overlay-controls .shiftselect {
	color: #9AAEFF;
}
.overlay-controls .moveselect {
	color: #D9916B;
}
.overlay-controls .megaevo-box {
	padding-top: 0;
	padding-bottom: 10px;
}
.overlay-controls .megaevo {
	width: 149px;
	margin: 0;
}

.overlay-controls .whatdo {
	width: auto;
	padding: 2px 8px;
}

/*********************************************************
 * Team Selector
 *********************************************************/

.formatselect, .teamselect {
	width: 246px;
	min-height: 32px;
	padding: 0 5px;
	height: auto;
}
.team:focus {
	outline: 0 none;
	border: 1px solid #004488;
	box-shadow: inset 0px 1px 2px #D2D2D2, 0px 0px 5px #2266AA;
}
.select.teamselect {
	height: 49px;
	white-space: nowrap;
	overflow: hidden;
}
.teamselect .team {
	margin: -1px 0 0 -6px;
	width: 226px;
}
.select:disabled .team, .select:disabled:hover .team, .select:disabled:active .team,
.dark .select:disabled .team, .dark .select:disabled:hover .team, .dark .select:disabled:active .team {
	background: transparent;
	box-shadow: none;
}
.dark .preselected .team small {
	filter: none;
}
.teamlist .team, .teamdropdown .team {
	display: inline-block;
	vertical-align: middle;
}
.teamdropdown {
	list-style: none;
	margin: 0 -3px;
	padding: 0;
}
.teamdropdown .team {
	width: 285px;
}

/*********************************************************
 * Popups
 *********************************************************/

.ps-popup .label {
	width: 210px;
	margin: 0 auto;
}
.ps-popup .textbox {
	width: 200px;
}

.userstatus {
	font-style: italic;
	font-size: 8pt;
	word-wrap: break-word;
	overflow: hidden;
	max-height: 21pt;
	display: block;
}
.usergroup {
	color: #333;
	font-size: 8pt;
	font-weight: bold;
}
.dark .usergroup {
	color: #BBB;
}

.userdetails {
	min-height: 80px;
	width: 191px;
	padding: 1px 1px 1px 86px;
	margin: 5px 0;
}
.userdetails img {
	float: left;
	margin-left: -85px;
}
.userdetails .rooms {
	font-size: 8pt;
}
.userdetails .offline {
	color: red;
}
.trainersprite.yours {
	cursor: pointer;
}
.buttonbar {
	clear: both;
}
.buttonmenu p {
	margin: 3px 0;
}
.buttonmenu legend {
	font-size: 9pt;
	color: #555;
}
.dark .buttonmenu legend {
	color: #AAA;
}
.buttonmenu .fieldset {
	padding: 1px 8px 5px;
	margin: 8px 0;
}

.bglist {
	margin: 0 -7px;
}
.avatarlist button,
.formlist button,
.bglist button {
	display: block;
	float: left;
	margin: 2px;
	padding: 2px;

	border: 1px solid transparent;
	border-radius: 4px;
	box-shadow: none;
	background: transparent;
}
.avatarlist button, .dark .avatarlist button {
	width: 80px;
	height: 80px;
	background: transparent url(https://play.pokemonshowdown.com/sprites/trainers-sheet.png) no-repeat scroll 0px 0px;
}
.bglist button span {
	display: block;
	width: 144px;
	height: 90px;
	background: url(../fx/client-bgsheet.png) no-repeat scroll 0px 0px;
}
.avatarlist button.cur,
.formlist button.cur,
.bglist button.cur {
	border-color: #999999;
}
.avatarlist button:hover,
.avatarlist button.cur:hover,
.formlist button:hover,
.formlist button.cur:hover,
.bglist button:hover,
.bglist button.cur:hover {
	border: 1px solid #8899AA;
	background-color: #F1F4F9;
	box-shadow: 1px 1px 1px #D5D5D5;
}

.volume {
	min-height: 34px;
}
.volume label {
	font-size: 9pt;
}
.volume em {
	display: block;
	font-size: 9pt;
	color: #555555;
	width: 150px;
	height: 20px;
	margin: 2px;
}
.volume input {
	display: block;
	width: 150px;
	height: 20px;
	margin: 2px;
}

.preview {
	float: right;
}

/*********************************************************
 * Dark mode!
 *********************************************************/

.dark .ps-room.ps-room-light,
.dark .ps-room-light,
.dark .tournament-box,
.dark .tournament-status,
.dark .tournament-toggle,
.dark .pm-log-add {
	background: rgba(0,0,0,.8);
	color: #DDD;
}

.dark .ps-room.ps-room-opaque,
.dark .battle-log-add {
	background: #444444;
	color: #DDD;
}

/* chat */

.dark .userlist strong,
.dark .userlist span {
	text-shadow: 1px 1px 0 #222222;
}

/*********************************************************
 * Modern home — scoped to the lobby, preserving battle UI
 *********************************************************/
.showdown-home {
	--home-ink: #182b35;
	--home-muted: #566771;
	--home-paper: #f5f4ef;
	--home-card: #ffffff;
	--home-line: #dce2df;
	box-sizing: border-box;
	min-height: 100%;
	padding: 32px clamp(16px, 4vw, 40px);
	background: var(--home-paper);
	color: var(--home-ink);
	font-family: Inter, system-ui, sans-serif;
	container-type: inline-size;
}
.dark .showdown-home {
	--home-ink: #edf3f1;
	--home-muted: #acbdbb;
	--home-paper: #142126;
	--home-card: #1e3036;
	--home-line: #385058;
}
.showdown-intro { margin-bottom: 32px; }
.showdown-eyebrow {
	font-size: 11px;
	font-weight: 800;
	letter-spacing: .18em;
	color: var(--home-muted);
}
.showdown-intro h1 {
	font-size: clamp(28px, 5vw, 44px);
	letter-spacing: -.05em;
	line-height: 1.12;
	margin: 18px 0 12px;
	max-width: 470px;
}
.showdown-intro > p:last-child { font-size: 14px; line-height: 1.6; color: var(--home-muted); }
.showdown-home > .mainmenu,
.showdown-home > .mainmenu.tiny-layout { position: static; min-height: 0; width: auto; }
.showdown-home .mainmenu-left,
.showdown-home .mainmenu-right { width: auto; padding: 0; position: static; }
.showdown-home .menugroup {
	box-sizing: border-box;
	max-width: none;
	width: 100%;
	margin: 0 0 24px;
	padding: 20px;
	border: 1px solid var(--home-line);
	border-radius: 16px;
	background: var(--home-card);
	color: var(--home-ink);
	text-shadow: none;
	backdrop-filter: none;
}
.showdown-section-title {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	font-size: 16px;
	letter-spacing: -.02em;
	margin: 0 0 14px;
	text-align: left;
}
.showdown-section-title span { font-size: 9px; font-weight: 600; letter-spacing: .09em; color: var(--home-muted); }
.showdown-home .menugroup .label { width: auto; margin: 0 0 8px; color: var(--home-muted); font-weight: 600; }
.showdown-home .menugroup .select {
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	min-height: 48px;
	border: 1px solid var(--home-line);
	border-radius: 9px;
	background: var(--home-paper);
	color: var(--home-ink);
	box-shadow: none;
	text-shadow: none;
	padding: 10px 12px;
	font-size: 14px;
}
.showdown-home .menugroup .teamselect { min-height: 72px; }
.showdown-home .menugroup .teamselect.preselected { opacity: 1; }
.showdown-home .mainmenu.button {
	position: static;
	min-height: 48px;
	width: 100%;
	padding: 13px 14px;
	border: 1px solid var(--home-line);
	border-radius: 10px;
	background: var(--home-card);
	color: var(--home-ink);
	font: 600 14px/1.4 Inter, system-ui, sans-serif;
	text-shadow: none;
	box-shadow: none;
	text-align: left;
	transition: background .15s, border-color .15s;
}
.showdown-home .mainmenu.button i { width: 24px; color: #d66a35; }
.showdown-home .mainmenu.button:hover { background: var(--home-paper); border-color: #d66a35; }
.showdown-home .mainmenu.button.big {
	height: auto;
	min-height: 64px;
	background: #ffb16c;
	border-color: #ffb16c;
	color: #332317;
	text-align: center;
	font-size: 19px;
	margin-top: 8px;
}
.showdown-home .mainmenu.button.big:hover { background: #ffc18d; }
.showdown-home .mainmenu.button.big small { font-size: 12px; font-weight: 400; }
.showdown-home .mainmenu.button.big br { display: none; }
.showdown-home .mainmenu.button.disabled { background: var(--home-paper); color: var(--home-muted); border-color: var(--home-line); }
.showdown-home .showdown-nav { padding: 0; border: 0; background: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.showdown-nav .showdown-section-title { grid-column: 1 / -1; margin: 8px 0 4px; }
.showdown-home .showdown-nav p { margin: 0; }
.showdown-home .showdown-nav p:first-of-type:last-of-type,
.showdown-home .showdown-nav p:first-of-type:nth-last-of-type(3) { grid-column: 1 / -1; }
.showdown-home .mainmenu-footer { position: static; padding: 0 0 24px; color: var(--home-muted); text-shadow: none; line-height: 1.9; }
.showdown-home .mainmenu-footer a,
.showdown-home .mainmenu-footer button { color: var(--home-muted); text-shadow: none; }
.showdown-home .bgcredit { display: none; }
.showdown-home .mainmenu-mini-windows,
.showdown-home .mainmenu-mini-windows.tiny-layout { position: static; width: auto; padding: 0; }
.showdown-home .mini-window { margin: 0 0 16px; width: 100%; max-width: 100%; box-sizing: border-box; }
.showdown-home .mini-window-header { padding: 10px; background: var(--home-card); color: var(--home-ink); border-color: var(--home-line); text-shadow: none; border-radius: 10px 10px 0 0; }
.showdown-home .mini-window-contents { background: var(--home-card); color: var(--home-ink); border-color: var(--home-line); border-radius: 0 0 10px 10px; }
.showdown-home .button:focus-visible,
.showdown-home a:focus-visible { outline: 3px solid #218aab; outline-offset: 3px; }
@container (min-width: 680px) {
	.showdown-home .mainmenu-left { display: grid; grid-template-columns: 1.1fr 1fr; column-gap: 28px; align-items: start; }
	.showdown-home .mainmenu-left > .showdown-section-title { grid-column: 1; }
	.showdown-home .mainmenu-left > form { grid-column: 1; grid-row: 2 / 4; }
	.showdown-home .mainmenu-left > .showdown-nav { grid-column: 2; }
}
@media (max-width: 600px) {
	.showdown-home { padding: 22px 16px max(24px, env(safe-area-inset-bottom)); }
	.showdown-intro { margin-bottom: 24px; }
	.showdown-intro h1 { font-size: 32px; }
	.showdown-home .menugroup { padding: 16px; }
	.showdown-home .showdown-nav { padding: 0; }
	.showdown-home .mainmenu.button { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
	.showdown-home .mainmenu.button { transition: none; }
}
/* The room directory and navigation share the lobby's quiet surfaces. */
.header, .header-vertical { background: #e7ece9; }
.mini-header, .maintabbarbottom { background: #e7ece9; }
.dark .header, .dark .header-vertical, .dark .mini-header, .dark .maintabbarbottom { background: #1e3036; }
.header-vertical .tablist li .button { min-height: 44px; box-sizing: border-box; padding: 12px; border-radius: 8px; }
#room-rooms { background: #eef1ed; font-family: Inter, system-ui, sans-serif; color: #182b35; }
.dark #room-rooms { background: #142126; color: #edf3f1; }
#room-rooms .roomlist h2 { font-size: 17px; letter-spacing: -.02em; margin-top: 28px; }
#room-rooms .roomlist a.blocklink { border: 1px solid #dce2df; background: #fff; padding: 12px; border-radius: 10px; box-shadow: none; color: #24566d; }
.dark #room-rooms .roomlist a.blocklink { border-color: #385058; background: #1e3036; color: #b7dce9; }
#room-rooms .roomlist a.blocklink:hover { border-color: #d66a35; }
#room-rooms .roomcounters button { background: transparent; box-shadow: none; border: 0; color: inherit; }
#room-rooms input[type="text"], #room-rooms input[type="search"], #room-rooms select { min-height: 40px; border-radius: 8px; border: 1px solid #b9c8c5; padding: 8px; box-sizing: border-box; }
.showdown-home .menugroup .button.small { min-height: 36px; padding: 8px 12px; background: var(--home-paper); color: var(--home-ink); border: 1px solid var(--home-line); border-radius: 8px; box-shadow: none; }
.showdown-home .showdown-nav > p { min-width: 0; }
.showdown-home .showdown-nav .button { overflow-wrap: anywhere; }
@media (max-width: 350px) {
	.showdown-section-title span { font-size: 8px; letter-spacing: 0; }
	.showdown-home .mainmenu.button { padding: 12px 8px; }
	.showdown-home .mainmenu.button i { width: 18px; }
}

/* Portrait battle workspace: the field stays visible while choices and log scroll independently. */
.mobile-pp-label, .mobile-pokemon-hp { display: none; }
.mobile-battle {
	--battle-paper: #f3f5f3;
	--battle-card: #fff;
	--battle-ink: #172d36;
	--battle-muted: #53676f;
	--battle-line: #d3dedb;
	height: 100%;
	display: flex;
	flex-direction: column;
	background: var(--battle-paper);
	color: var(--battle-ink);
	font-family: system-ui, sans-serif;
}
.dark .mobile-battle {
	--battle-paper: #142126;
	--battle-card: #20333a;
	--battle-ink: #f0f5f3;
	--battle-muted: #afc2c5;
	--battle-line: #3a525b;
}
.mobile-battle [hidden] { display: none !important; }
.mobile-battle-field { position: relative; flex: none; overflow: hidden; margin: 0 auto; }
.mobile-battle-status { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 12px; font-size: 13px; border-bottom: 1px solid var(--battle-line); }
.mobile-battle-status > strong { color: var(--battle-ink); }
.mobile-battle-status .button { position: static !important; min-height: 36px; margin: 3px 0; }
.mobile-battle-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 6px 10px; gap: 6px; flex: none; border-bottom: 1px solid var(--battle-line); }
.mobile-battle-tabs button { min-height: 44px; border: 0; border-radius: 9px; font: 600 13px system-ui, sans-serif; background: transparent; color: var(--battle-muted); }
.mobile-battle-tabs button[aria-pressed="true"] { background: var(--battle-ink); color: var(--battle-paper); }
.mobile-battle-tabs i { margin-right: 4px; }
.mobile-battle-body { position: relative; flex: 1; min-height: 0; }
.mobile-battle-actions { box-sizing: border-box; height: 100%; overflow-y: auto; overflow-x: hidden; padding: 10px 12px max(16px, env(safe-area-inset-bottom)); }
.mobile-battle .battle-controls { position: static; width: auto; }
.mobile-battle .inline-controls { margin: 0; padding: 0; }
.mobile-battle .whatdo { font-size: 14px; line-height: 1.5; padding: 6px 0 12px; color: var(--battle-ink); }
.mobile-inspect-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; color: var(--battle-muted); font-size: 11px; }
.mobile-battle .button { min-height: 40px; border: 1px solid var(--battle-line); border-radius: 8px; background: var(--battle-card); color: var(--battle-ink); box-shadow: none; text-shadow: none; padding: 8px 12px; }
.mobile-battle .button[aria-pressed="true"] { border-color: #da773e; }
.mobile-battle .mobile-choice-moves > .switchcontrols,
.mobile-battle .mobile-choice-switch > .movecontrols { display: none; }
.mobile-battle .movecontrols, .mobile-battle .switchcontrols { max-width: none; padding: 0; margin: 0; }
.mobile-battle .moveselect, .mobile-battle .switchselect { padding: 0 0 8px; font: 600 12px system-ui, sans-serif; color: var(--battle-muted); }
.mobile-battle .movemenu, .mobile-battle .switchmenu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; }
.mobile-battle .switchmenu:after { display: none; }
.mobile-battle .movemenu > p, .mobile-battle .megaevo-box { grid-column: 1 / -1; }
.mobile-battle .movebutton, .mobile-battle .switchmenu button {
	box-sizing: border-box;
	width: 100%; min-width: 0; min-height: 76px;
	margin: 0; padding: 12px;
	float: none; border-radius: 12px;
	box-shadow: none; text-shadow: none;
	font: 600 14px/1.35 system-ui, sans-serif;
	text-align: left; white-space: normal;
	touch-action: manipulation;
}
.mobile-battle .movemenu .movebutton { background: var(--battle-card); color: var(--battle-ink); border-width: 1px 1px 1px 5px; }
.mobile-battle .movemenu .movebutton:hover { background: var(--battle-paper); }
.mobile-battle .movemenu .movebutton small { color: var(--battle-muted); font: 500 11px/1.6 system-ui, sans-serif; }
.mobile-battle .movebutton .type { display: block; float: none; margin-top: 6px; }
.mobile-battle .movebutton .pp { float: none; display: block; text-align: left; }
.mobile-battle .mobile-pp-label { display: inline; }
.mobile-battle .switchmenu button { min-height: 72px; padding: 10px 8px 16px; background: var(--battle-card); color: var(--battle-ink); border-color: var(--battle-line); }
.mobile-battle .switchmenu button .picon { margin: 0 4px 0 0; }
.mobile-battle .mobile-pokemon-hp { display: block; font: 500 11px/1.5 system-ui, sans-serif; color: var(--battle-muted); clear: both; padding-top: 4px; }
.mobile-battle .switchmenu button .hpbar { left: 8px; right: 8px; bottom: 7px; height: 4px; }
.mobile-battle .switchmenu button .hpbar span { height: 3px; max-width: 100%; }
.mobile-battle .megaevo { box-sizing: border-box; min-height: 44px; padding: 12px; border-radius: 9px; border: 1px solid var(--battle-line); background: var(--battle-card); color: var(--battle-ink); }
.mobile-battle .megaevo.cur { border-color: #da773e; background: var(--battle-paper); }
.mobile-battle .megaevo input { width: 20px; height: 20px; }
.mobile-battle-chat { position: relative; height: 100%; }
.mobile-battle-chat .battle-log { top: 0 !important; left: 0 !important; right: 0; width: auto; bottom: 58px; background: var(--battle-card); color: var(--battle-ink); border: 0; font-size: 13px; }
.mobile-battle-chat .chat-log-add { background: var(--battle-paper); }
.mobile-battle button:focus-visible { outline: 3px solid #1686b0; outline-offset: 2px; }
.mobile-battle .movemenu button[aria-disabled="true"], .mobile-battle .switchmenu button[aria-disabled="true"] { opacity: .55; }
@media (max-height: 720px) {
	.mobile-battle .movebutton { min-height: 68px; padding: 8px 10px; }
	.mobile-battle .whatdo { padding: 3px 0 6px; }
	.mobile-battle .moveselect { display: none; }
}
.mobile-battle .movebutton { height: auto; min-height: 88px; }
.mobile-battle .movebutton br { display: none; }
.mobile-battle .switchmenu > div[style] { grid-column: 1 / -1; height: 0; }
.mobile-matchup { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--battle-line); }
.mobile-matchup button { width: 100%; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px; border: 0; border-radius: 8px; background: var(--battle-card); color: var(--battle-ink); padding: 6px 8px; text-align: left; font: 12px system-ui, sans-serif; }
.mobile-matchup button span { color: var(--battle-muted); font-size: 11px; }
.mobile-battle-landscape { display: grid; grid-template-columns: 46% 54%; grid-template-rows: auto auto 1fr; }
.mobile-battle-landscape .mobile-battle-field { grid-column: 1; grid-row: 1; }
.mobile-battle-landscape .mobile-matchup { grid-column: 1; grid-row: 2; }
.mobile-battle-landscape .mobile-battle-status { grid-column: 1; grid-row: 3; align-self: start; }
.mobile-battle-landscape .mobile-battle-tabs { grid-column: 2; grid-row: 1; align-self: start; }
.mobile-battle-landscape .mobile-battle-body { grid-column: 2; grid-row: 1 / 4; margin-top: 57px; border-left: 1px solid var(--battle-line); }
.mobile-battle-details { box-sizing: border-box; width: calc(100% - 20px); max-width: 520px; max-height: 80dvh; padding: 0; border: 1px solid var(--battle-line); border-radius: 16px; background: var(--battle-card); color: var(--battle-ink); font: 14px/1.5 system-ui, sans-serif; }
.mobile-battle-details::backdrop { background: #071a27aa; }
.mobile-details-heading { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--battle-card); border-bottom: 1px solid var(--battle-line); }
.mobile-details-heading .button { min-height: 44px; }
.mobile-details-content { padding: 0 16px 16px; overflow-wrap: anywhere; }
.mobile-details-content h2 { font-size: 19px; }
.mobile-details-content h2 small { font-size: 12px; }
@media (max-height: 720px) and (orientation: portrait) {
	.mobile-battle .movebutton { min-height: 68px; padding: 8px 10px; font-size: 13px; }
	.mobile-battle .movebutton .type { margin-top: 2px; }
	.mobile-battle .mobile-inspect-bar { float: right; position: relative; z-index: 1; margin: 0 0 6px 8px; }
	.mobile-battle .mobile-inspect-bar > span { display: none; }
	.mobile-battle .whatdo { min-height: 40px; box-sizing: border-box; padding: 9px 72px 9px 0; }
	.mobile-battle .movecontrols, .mobile-battle .switchcontrols { clear: both; }
	.mobile-battle .moveselect { display: none; }
}
.mobile-battle .move-spacer { display: none; }

/* End-of-battle actions share one layout instead of floats and spacer breaks. */
.battle-result-primary, .battle-result-secondary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.battle-result-controls .button { box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 44px; margin: 0; white-space: normal; text-align: center; }
.battle-result-primary > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.mobile-battle .battle-result-primary > :first-child { background: var(--battle-ink); color: var(--battle-paper); }
.mobile-battle .battle-result-secondary { padding-top: 12px; border-top: 1px solid var(--battle-line); }
/* Keep animated Pokémon on separate compositing layers inside the scaled mobile
 * battlefield. This is a mitigation for reported iPhone animation-edge artifacts;
 * confirm on-device before treating it as a resolved WebKit issue. */
.mobile-battle .battle img[src*="/sprites/ani/"],
.mobile-battle .battle img[src*="/sprites/ani-back/"],
.mobile-battle .battle img[src*="/sprites/ani-shiny/"],
.mobile-battle .battle img[src*="/sprites/ani-back-shiny/"] {
	transform: translateZ(0);
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

/* Phone popups use a scrollable sheet with an always reachable close action. */
.ps-popup.mobile-popup {
	position: fixed; top: max(8px, env(safe-area-inset-top));
	left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); bottom: auto;
	box-sizing: border-box; width: auto; min-width: 0; max-width: none;
	max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
	margin: 0; padding: 0 0 max(8px, env(safe-area-inset-bottom));
	overflow: auto; overscroll-behavior: contain;
	border-radius: 16px; background: #f3f6f4; color: #172d36;
	box-shadow: 0 12px 48px #071a2740; font: 15px/1.5 system-ui, sans-serif;
}
.dark .ps-popup.mobile-popup { background: #142126; color: #f0f5f3; }
.mobile-popup-heading { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: inherit; border-bottom: 1px solid #899a9d55; }
.mobile-popup-heading strong { min-width: 0; overflow-wrap: anywhere; font-size: 18px; }
.mobile-popup > .pad { padding: 12px 16px; }
.mobile-popup .button, .mobile-popup .select, .mobile-popup .textbox { box-sizing: border-box; min-height: 44px; max-width: 100%; font-size: 16px; border-radius: 8px; }
.mobile-popup .button { padding: 8px 12px; white-space: normal; }
.mobile-popup input[type="checkbox"], .mobile-popup input[type="radio"] { width: 20px; height: 20px; vertical-align: middle; margin-right: 8px; }
.mobile-popup label.checkbox { font: inherit; display: block; box-sizing: border-box; min-height: 44px; padding: 10px 0; }
.mobile-popup .optlabel { font-size: 15px; display: block; width: auto; min-height: 44px; margin: 12px 0; }
.mobile-popup .optlabel select, .mobile-popup .optlabel > .button { display: block; float: none; width: 100%; margin: 6px 0 0; }
.mobile-popup h3 { margin-top: 16px; }
.mobile-popup p { overflow-wrap: anywhere; }

/* A real document scroll lets mobile browsers retract their toolbars. The app
 * header scrolls away; the battle expands with the changing visible viewport. */
html:has(.landscape-battle-page), html:has(.landscape-battle-page) body {
	overflow-x: clip;
	overflow-y: visible;
}
.ps-frame.landscape-battle-page { height: calc(100dvh + 44px); }
.landscape-battle-page .mini-header { height: 44px; line-height: 44px; }
.landscape-battle-page .mini-header-left, .landscape-battle-page .mini-header-right { min-width: 44px; min-height: 44px; }
.landscape-battle-page .ps-room:has(> .mobile-battle-landscape) { top: 44px !important; }
.mobile-battle-landscape .mobile-battle-tabs { padding: 4px 8px; gap: 4px; }
.mobile-battle-landscape .mobile-battle-body { margin-top: 53px; }
.mobile-battle-landscape .mobile-battle-actions { padding: 6px 10px max(10px, env(safe-area-inset-bottom)); }
.mobile-battle-landscape .mobile-inspect-bar { float: right; margin: 0 0 4px 8px; position: relative; z-index: 1; }
.mobile-battle-landscape .mobile-inspect-bar > span { display: none; }
.mobile-battle-landscape .whatdo { min-height: 44px; padding: 8px 76px 6px 0; box-sizing: border-box; }
.mobile-battle-landscape .movecontrols, .mobile-battle-landscape .switchcontrols { clear: both; }
.mobile-battle-landscape .moveselect { display: none; }
.mobile-battle-landscape .movebutton { min-height: 68px; padding: 8px 10px; font-size: 14px; }
.mobile-battle-landscape .movebutton .type { margin-top: 2px; }
.mobile-battle-landscape .mobile-matchup { gap: 4px; padding: 4px 8px; }

/* Mobile browser chrome and overscroll must sample the theme surface, not the
 * legacy wallpaper (which may also be set by an inline background preference). */
@media (max-width: 700px), (pointer: coarse) and (max-width: 1000px) and (max-height: 500px) {
	body { background: var(--page-surface, #f3f5f3) !important; }
}

/* Playback and intermediate actions use the same columns as move/team cards. */
.mobile-battle .battle-action-grid {
	display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px; clear: both; margin: 0 0 12px; padding: 0;
}
.mobile-battle .battle-action-grid > .button {
	box-sizing: border-box; display: flex; align-items: center; justify-content: center;
	gap: 6px; width: 100%; min-width: 0 !important; min-height: 44px;
	margin: 0 !important; float: none; white-space: normal; text-align: center;
}
.mobile-battle .battle-action-grid > .button > br { display: none; }
.mobile-battle .battle-action-grid > .button:last-child:nth-child(odd) { grid-column: 1 / -1; }
.mobile-battle .battle-action-grid > .button.disabled { opacity: .5; }
.mobile-battle-actions:not(:has(.mobile-inspect-bar)) .whatdo { padding-right: 0; }

.mobile-battle .whatdo:has(.battle-action-grid) { clear: both; padding-right: 0; }

.ps-popup .testclient-key-input { box-sizing: border-box; width: 100%; max-width: 100%; resize: vertical; font-size: 16px; -webkit-text-security: disc; }

.mobile-battle-title { font-weight: 600; }
.mobile-matchup > div { min-width: 0; }
.mobile-battle-status { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; padding: 0 8px; }
.mobile-battle-status > strong { font-size: 12px; }
.mobile-battle-status .button { min-height: 44px; padding: 6px 8px; font-size: 12px; }
.mobile-battle .mobile-forfeit { background: #a62f37; border-color: #a62f37; color: #fff; font-weight: 600; }
.mobile-battle .mobile-forfeit:hover { background: #86252c; color: #fff; }

/* iOS-style segmented navigation and grouped team cards. */
.mobile-battle { font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif; }
.mobile-battle-tabs { margin: 6px 10px; padding: 3px; gap: 3px; border: 0; border-radius: 12px; background: var(--battle-line); }
.mobile-battle-tabs button { border-radius: 9px; transition: background-color .15s, box-shadow .15s; }
.mobile-battle-tabs button[aria-pressed="true"] { background: var(--battle-card); color: var(--battle-ink); box-shadow: 0 2px 5px #0002; }
.mobile-battle-tabs, .mobile-battle-body { touch-action: pan-y pinch-zoom; }
.mobile-battle button { -webkit-tap-highlight-color: transparent; }
.mobile-battle button:active { filter: brightness(.92); }
.mobile-battle .switchmenu:has(.mobile-team-summary) { grid-template-columns: minmax(0, 1fr); }
.mobile-battle .switchmenu button:has(.mobile-team-summary) { padding: 12px 14px 20px; font-size: 16px; }
.mobile-team-summary { display: block; clear: both; padding-top: 8px; font: 400 13px/1.5 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; }
.mobile-team-item, .mobile-team-ability { display: block; overflow-wrap: anywhere; }
.mobile-team-item { color: var(--battle-ink); }
.mobile-team-ability { color: var(--battle-muted); }
.mobile-team-moves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 8px; padding-top: 8px; }
.mobile-team-moves > span { padding: 5px 8px; border-radius: 7px; background: var(--battle-paper); color: var(--battle-ink); overflow-wrap: anywhere; }
.mobile-battle .switchmenu button[aria-disabled="true"]:has(.mobile-team-summary) { opacity: 1; }
.mobile-battle .switchmenu button[aria-disabled="true"]:has(.mobile-team-summary) .mobile-pokemon-hp { font-style: italic; }
.mobile-battle-details { margin: auto auto 0; width: 100%; max-width: 600px; max-height: 88dvh; border-radius: 22px 22px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); overscroll-behavior: contain; }
.mobile-details-heading { padding-top: 20px; touch-action: none; z-index: 1; }
.mobile-details-heading::before { content: ''; position: absolute; top: 7px; left: calc(50% - 18px); width: 36px; height: 5px; border-radius: 3px; background: var(--battle-muted); opacity: .45; }
.mobile-details-content { font-size: 16px; line-height: 1.55; }
.mobile-battle-landscape .mobile-battle-tabs { margin: 4px 8px; padding: 3px; }
.mobile-battle-landscape .mobile-battle-body { margin-top: 58px; }
@media (prefers-reduced-motion: reduce) {
 .mobile-battle-tabs button { transition: none; }
}

/* Inspect shares the navigation row instead of displacing battle choices. */
.mobile-battle-tabs:has(.mobile-inspect-toggle) { grid-template-columns: repeat(3, minmax(0, 1fr)) 44px; }
.mobile-battle-tabs .mobile-inspect-toggle { border-left: 1px solid var(--battle-muted); border-radius: 8px; }
.mobile-battle-tabs .mobile-inspect-toggle i { margin: 0; }
.mobile-inspect-hint { margin: 0 0 8px; font-size: 12px; color: var(--battle-muted); }
.mobile-battle .whatdo, .mobile-battle-landscape .whatdo { min-height: 0; padding: 2px 0 6px; }
.mobile-battle .moveselect { display: none; }
.mobile-battle .megaevo-box { margin-top: 0; }
.mobile-battle .megaevo { padding: 8px 10px; }
.dark .mobile-battle-tabs { background: #1b2b31; }
.dark .mobile-battle-tabs button[aria-pressed="true"] { background: #30434b; color: #d9e5e8; box-shadow: inset 0 0 0 1px #455b63; }
.dark .mobile-battle .megaevo.cur { background: #293d45; border-color: #668892; color: #d9e5e8; }
.dark .mobile-battle .button[aria-pressed="true"] { background: #293d45; border-color: #668892; color: #d9e5e8; }
.dark .mobile-battle input { accent-color: #799aa5; }
.dark .mobile-battle .switchmenu button:hover,
.dark .mobile-battle .switchmenu button:active,
.dark .mobile-battle .movemenu .movebutton:active { background: #293d45; color: #d9e5e8; }
.mobile-battle .megaevo-box { padding: 0; }
.mobile-battle .megaevo, .mobile-battle .megaevo:has(:checked) { text-shadow: none; font: 600 13px/1.3 system-ui, sans-serif; }
.dark .mobile-battle .megaevo:has(:checked) { background: #293d45; color: #d9e5e8; border-color: #668892; }
.dark .mobile-battle .movemenu .movebutton { border-top-color: var(--battle-line); border-right-color: var(--battle-line); border-bottom-color: var(--battle-line); }
.mobile-battle-landscape .movebutton br { display: block; }
.mobile-battle-landscape .movebutton .type, .mobile-battle-landscape .movebutton .pp { display: inline; margin: 0; }
.mobile-battle-landscape .movebutton .pp { margin-left: 6px; }
.mobile-battle-landscape .movebutton { min-height: 60px; }

/* Legacy disabled choices force a light background with !important. Keep
 * waiting-team cards and unavailable choices on the current theme surface. */
.mobile-battle .switchmenu button.disabled,
.mobile-battle .switchmenu button:disabled,
.mobile-battle .movebutton.disabled,
.mobile-battle .movebutton:disabled {
	background: var(--battle-card) !important;
	border-color: var(--battle-line) !important;
	color: var(--battle-muted) !important;
}
