/* Phones and small tablets only: index.php loads this with media="(max-width: 999px)".
   The three desktop columns become one: the left menu is a slide-in drawer, the right boxes follow the content. */

body {
  padding-top: 51px;
  -webkit-text-size-adjust: 100%;
}
body.MobileMenuOpen {
  overflow: hidden;
}

#ArtworkHelper, #Bodycontainer {
  min-width: 0;
  width: auto;
  height: auto;
}
#Bodycontainer {
  display: block;
}
#ArtworkHelper .logo, #LeftArtwork, #RightArtwork #Monster, #PedestalAndOnline {
  display: none;
}

/* top bar */
#MobileBar {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  z-index: 1001;
  background-color: #0D2E2B;
  border-bottom: 1px solid #5f4d41;
}
#MobileMenuButton {
  position: absolute;
  top: 0;
  left: 0;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 0;
  background: none;
  color: #ffd18c;
  font-size: 26px;
  line-height: 50px;
  cursor: pointer;
}
#MobileLogo {
  position: absolute;
  top: 7px;
  left: 50px;
}
#MobileLogo img {
  display: block;
  height: 36px;
  width: auto;
}
#RightArtwork {
  position: static;
  width: auto;
}
#RightArtwork #PlayersOnline {
  position: fixed;
  top: 13px;
  bottom: auto;
  left: auto;
  right: 64px;
  width: 92px;
  z-index: 1002;
  border-bottom: 0;
}
#LanguageMenu {
  position: fixed;
  top: 8px;
  right: 6px;
  min-width: 0;
  z-index: 1002;
}
#LanguageMenu summary {
  padding: 8px;
  font-size: 0;
}
#LanguageMenu summary::after {
  font-size: 11px;
}
#LanguageMenu a {
  padding: 10px 8px;
}

/* the left column as a drawer */
#MenuColumn {
  position: fixed;
  top: 51px;
  bottom: 0;
  left: 0;
  margin: 0;
  padding: 14px 10px 20px 5px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 1000;
  background-color: #051122;
  transform: translateX(-100%);
  transition: transform .2s;
}
.MobileMenuOpen #MenuColumn {
  transform: none;
}
#MobileMenuBackdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background-color: rgba(0, 0, 0, .6);
}
.MobileMenuOpen #MobileMenuBackdrop {
  display: block;
}
.SubmenuitemLabel {
  padding-top: 9px;
  padding-bottom: 9px;
}
.LeftChain, .RightChain {
  height: 100%;
}
.ActiveSubmenuItemIcon {
  top: 11px;
}

/* content, then the side boxes, then the footer (which sits inside #ContentColumn) */
#ContentRow {
  top: 0;
  display: flex;
  flex-direction: column;
}
#ContentColumn {
  display: contents;
}
.Content {
  order: 1;
  min-width: 0;
  padding-top: 5px;
}
#ThemeboxesColumn {
  order: 2;
  position: static;
  width: auto;
  margin: 0;
}
#Footer {
  order: 3;
}
#Themeboxes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 10px;
  padding-top: 16px;
}
/* highscores: on desktop the <br>s after the box make room for its list, which is taller than the box */
#Themeboxes br {
  display: none;
}
#Themeboxes #Topbar {
  height: 200px;
}
/* gallerybox.gif is only the header: desktop shows the page art behind the picture */
#Themeboxes #GalleryBox {
  background-image: url(images/themeboxes/gallery/gallerybox.gif), url(images/themeboxes/box-bg.gif) !important;
  background-position: 0 0, 0 20px;
  background-size: auto, 180px 128px; /* stops inside the bottom edge */
}
#Themeboxes #GalleryBox #GalleryContent {
  margin-top: 0;
}

/* A table that can't shrink scrolls inside its box instead of widening the page. */
.Content .BoxContent {
  padding: 6px;
  min-height: 0;
  overflow-x: auto;
}
/* outfit sprites sit on negative margins and must keep their size */
.BoxContent img:not([style*="margin-left:-"]) {
  max-width: 100%;
}
/* character page: the outfit portrait floats 380px to the right on desktop */
.BoxContent div[style*="margin-left:380px"] {
  position: static !important;
  margin: 6px auto !important;
}
.BoxContent input, .BoxContent select, .BoxContent textarea {
  max-width: 100%;
  box-sizing: border-box;
}
.TableContainer {
  box-sizing: border-box;
}
.LabelH, .LabelV, .Content th {
  white-space: normal;
}
.BoxContent table {
  max-width: 100%;
}
.Content .BoxContent table[style*="width: 370px"] {
  width: 100% !important;
}
/* login form: its buttons go under the fields, "remember me" lines up with them */
.BoxContent table[style*="width: 370px"] + div {
  float: none !important;
  clear: both;
  padding-top: 6px;
}
.BoxContent td.LabelV:empty {
  display: none;
}
/* form rows: label, field and button stack, as wide as the box (radio rows keep their column headings) */
.BoxContent tr:has(> td input:not([type=radio], [type=checkbox], [type=hidden], [type=submit], [type=image]), > td select, > td textarea):not(:has(> td > input[type=radio])) > td {
  display: block;
  box-sizing: border-box;
  width: auto;
}
/* search boxes lay out their fields with table-cell divs */
.BoxContent div[style*="display: table-cell"] {
  display: block !important;
}
/* inner tables keep their column layout: no side margin that pushes them out of the box */
.TableContainer .Table3 .InnerTableContainer, .TableContainer .Table5 .InnerTableContainer {
  margin-left: 0;
}
/* Spells and Creatures (DataTables) */
.Content table.dataTable thead th, .Content table.dataTable tbody td {
  padding: 4px !important;
}
/* news bodies come from the DB: the outer table stays in the box, a wide inner table scrolls by itself */
.BoxContent table[style*="clear:both"] {
  table-layout: fixed;
}
.BoxContent table[style*="clear:both"] table {
  display: block;
  overflow-x: auto;
}
.BoxContent table[style*="clear:both"] table[style*="border-spacing"] tbody,
.BoxContent table[style*="clear:both"] table[style*="border-spacing"] tr {
  display: block;
}
.BoxContent table[style*="clear:both"] table[style*="border-spacing"] td {
  display: block;
  width: auto !important;
  margin-bottom: 6px;
}
/* shop: each offer is a card, image and description on top, points and the buy button below */
.offer_type {
  display: inline-block;
}
.offer_table, .offer_table > tbody {
  display: block;
}
.offer_table > tbody > tr {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
}
.offer_table > tbody > tr > td {
  width: auto;
}
.offer_table > tbody > tr > td[colspan] {
  grid-column: 1 / -1;
}
.offer_table > tbody > tr > td:nth-child(2) {
  overflow-wrap: anywhere;
}
/* highscores: the category list goes above the ranking */
#highscores .TableContent, #highscores .TableContent > tbody {
  display: block;
}
#highscores .TableContent > tbody > tr:has(> td table) {
  display: flex;
  flex-direction: column-reverse;
}
/* rows of big buttons wrap */
.InnerTableButtonRow, .InnerTableButtonRow > tbody {
  display: block;
}
.InnerTableButtonRow > tbody > tr {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

@media (max-width: 480px) {
  .Content .BoxContent td {
    font-size: 9pt;
  }
  .Content th, .TableContainer .CaptionContainer .Text {
    font-size: 9pt;
  }
  .TableContent td, .TableContainer .Table2 .InnerTableContainer td {
    padding-left: 2px;
    padding-right: 2px;
  }
  .TableContentAndRightShadow, .TableContentContainer {
    margin-right: 0;
  }
  #highscores .BoxContent td {
    font-size: 8pt;
  }
}
