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

body {
  overflow-x: clip;
}

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

pre,
code,
table {
  max-width: 100%;
}

pre {
  overflow-x: auto;
}

#site-topbar .nav-links li.nav-login-mobile {
  display: none;
}

@media (max-width: 760px) {
  #site-topbar .nav-links li.nav-login-mobile {
    display: block;
  }

  #site-topbar .search-wrapper {
    position: static;
  }

  .topnav .search-panel {
    position: fixed;
    top: calc(var(--topbar-height) + 6px);
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    width: auto;
    max-height: calc(100dvh - var(--topbar-height) - 24px);
    overflow-y: auto;
  }

  .topnav .search-results {
    max-height: 50dvh;
  }

  #site-topbar .topnav-inner {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
}

@media (max-width: 480px) {
  #site-topbar .topnav-inner {
    gap: 6px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  #site-topbar .topnav-logo {
    flex: 0 0 auto;
    min-width: auto;
    height: 56px;
  }

  #site-topbar .topnav-logo img {
    height: 36px;
    width: auto;
    max-width: none;
  }

  #site-topbar .topnav-actions {
    gap: 2px;
    min-width: 0;
  }

  #site-topbar .topnav-settings-btn.hero-settings-btn,
  #site-topbar .search-icon-img,
  #site-topbar .topnav-burger {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  #site-topbar .topnav-download {
    padding: 10px 12px;
    font-size: 13px;
    margin: 0 4px;
    white-space: nowrap;
  }
}

@media (max-width: 360px) {
  #site-topbar .topnav-logo img {
    height: 30px;
  }

  #site-topbar .topnav-download {
    padding: 9px 10px;
    font-size: 12px;
  }

  #site-topbar .topnav-settings-btn.hero-settings-btn,
  #site-topbar .search-icon-img,
  #site-topbar .topnav-burger {
    width: 36px;
    min-width: 36px;
  }
}

@media (hover: none) and (pointer: coarse) {
  a,
  button,
  select,
  summary,
  [role="button"] {
    touch-action: manipulation;
  }

  input,
  select,
  textarea {
    font-size: max(16px, 1em);
  }

  #site-topbar .nav-links a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  #site-topbar .topnav-inner {
    gap: 14px;
    padding-left: 16px;
    padding-right: 16px;
  }

  #site-topbar .topnav-logo img {
    height: 43px;
  }

  #site-topbar .nav-links {
    gap: 16px;
  }

  #site-topbar .nav-links a,
  #site-topbar .topnav-login {
    font-size: 14px;
  }

  #site-topbar .topnav-actions {
    gap: 10px;
  }

  #site-topbar .topnav-download {
    padding: 11px 16px;
    font-size: 14px;
  }
}

@supports (padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

.mobile-bottom-bar {
  display: none;
}

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  body {
    padding-bottom: calc(var(--bottombar-height, 64px) + env(safe-area-inset-bottom));
  }

  .mobile-bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: calc(var(--bottombar-height, 64px) + env(safe-area-inset-bottom));
    padding: 0 max(8px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-right));
    background: #303030;
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.04);
  }

  .mobile-bottom-bar .mbb-item {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .mobile-bottom-bar .mbb-item svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
  }

  .mobile-bottom-bar .mbb-mask {
    width: 48px;
    height: 48px;
    background-color: currentColor;
    -webkit-mask: url("../Icons/ButtonIcons/Inventions.png") center / contain no-repeat;
    mask: url("../Icons/ButtonIcons/Inventions.png") center / contain no-repeat;
  }

  .mobile-bottom-bar .mbb-item.active {
    color: #4a74f5;
  }
}

:root {
  --bottombar-height: 64px;
}

html:root {
  --topbar-total: calc(var(--topbar-height) + env(safe-area-inset-top, 0px));
}

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  html body #site-topbar.topnav {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    right: 0;
    height: var(--topbar-total) !important;
    padding: env(safe-area-inset-top, 0px) 0 0 !important;
    z-index: 160;
    transition: transform 0.25s ease;
  }

  html body #site-topbar.topnav.topbar-hidden {
    transform: translateY(-100%);
  }

  html body main {
    margin-top: calc(var(--topbar-total) + var(--announcement-h, 0px)) !important;
    min-height: calc(100vh - var(--topbar-total));
    min-height: calc(100dvh - var(--topbar-total) - var(--bottombar-height));
  }

  html body #site-topbar .topnav-inner {
    height: var(--topbar-height);
  }

  html body #site-topbar .nav-groups {
    max-height: calc(100vh - var(--topbar-total));
    max-height: calc(100dvh - var(--topbar-total) - var(--bottombar-height));
    overscroll-behavior: contain;
  }

  .topnav .search-panel {
    top: calc(var(--topbar-total) + 6px);
    max-height: calc(100dvh - var(--topbar-total) - var(--bottombar-height) - 24px);
  }

  .settings-panel {
    top: max(12px, env(safe-area-inset-top, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
  }

  .auth-modal-box,
  .news-modal-card,
  .egg-modal {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (min-width: 761px) and (max-width: 1024px) {
  html body #site-topbar .nav-links a,
  html body #site-topbar .nav-dropdown-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  html body #site-topbar .topnav-download {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

@media (min-width: 761px) and (max-width: 900px) {
  html body #site-topbar .nav-links {
    gap: 14px;
  }

  html body #site-topbar .topnav-inner {
    gap: 10px;
  }

  html body #site-topbar .topnav-actions {
    gap: 6px;
  }

  html body #site-topbar .topnav-login {
    padding: 10px 8px;
  }
}

@media (max-width: 1024px) and (min-width: 761px) {
  html body #site-topbar .nav-submenu {
    min-width: 200px;
  }
}

@media (max-width: 760px) {
  html body #site-topbar .nav-links a,
  html body #site-topbar .nav-dropdown-btn {
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  html body #site-topbar .nav-submenu a {
    min-height: 44px;
  }

  html body #site-topbar .topnav-download {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  html:root {
    --topbar-height: 52px;
    --bottombar-height: 46px;
  }

  html body #site-topbar .topnav-logo {
    height: 44px;
  }

  html body #site-topbar .topnav-logo img {
    height: 32px;
  }

  html body #site-topbar .topnav-inner {
    gap: 12px;
  }

  html body #site-topbar .nav-links {
    gap: 14px;
  }

  html body #site-topbar .nav-links a,
  html body #site-topbar .nav-dropdown-btn,
  html body #site-topbar .topnav-login {
    font-size: 13px;
    min-height: 0;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  html body #site-topbar .topnav-download {
    min-height: 34px;
    padding: 7px 14px;
    font-size: 13px;
  }

  html body #site-topbar .search-icon-img,
  html body #site-topbar .topnav-settings-btn.hero-settings-btn,
  html body #site-topbar .topnav-burger {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  html body #site-topbar .nav-submenu a {
    min-height: 36px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .mobile-bottom-bar .mbb-item svg {
    width: 24px;
    height: 24px;
  }

  .mobile-bottom-bar .mbb-mask {
    width: 36px;
    height: 36px;
  }

  .settings-panel {
    width: min(360px, 60vw);
  }

  .settings-panel-header {
    padding: 14px 20px 6px;
  }

  .settings-panel-body {
    padding: 4px 20px 8px;
    gap: 12px;
  }

  .settings-panel-footer {
    padding: 8px 20px 14px;
  }

  .topnav .search-panel {
    left: auto;
    right: max(12px, env(safe-area-inset-right));
    width: min(420px, 70vw);
  }

  .topnav .search-results {
    max-height: calc(100dvh - var(--topbar-total) - var(--bottombar-height) - 90px);
  }

  .auth-modal-box {
    padding: 20px 22px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body #site-topbar.topnav {
    transition: none;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .hero {
    width: calc(100% - 32px);
    min-height: 0;
    margin: 12px auto 20px;
    padding: 28px 20px 26px;
  }

  .hero-logo {
    width: auto;
    max-width: 48vw;
    max-height: clamp(90px, 34vh, 150px);
    margin-bottom: 10px;
  }

  .hero h1 {
    margin-bottom: 0;
    font-size: clamp(24px, 5vw, 34px);
  }

  .home-hero-banner {
    margin: 12px auto 20px;
    min-height: 0;
  }

  .home-hero-banner-content {
    min-height: 170px;
    padding: 22px 18px;
  }

  .home-hero-banner-logo {
    width: min(150px, 28vh);
  }
}

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  html body .contact-container,
  html body .faq-container,
  html body .priv-container,
  html body .tos-container,
  html body .status-container {
    padding-top: 32px;
    padding-bottom: 40px;
  }

  html body .updates-page-main,
  html body .users-page-main,
  html body .profile-page-main,
  html body .coming-soon-main,
  html body .games-page-main,
  html body .shop-page-main,
  html body .news-page-main,
  html body .admin-page-main {
    padding-top: 32px;
    padding-bottom: 40px;
  }

  html body main[class]:not(.download-page-main) {
    min-height: calc(100vh - var(--topbar-total));
    min-height: calc(100dvh - var(--topbar-total) - var(--bottombar-height));
  }

  html body .coming-soon-main {
    min-height: calc(100vh - var(--topbar-total));
    min-height: calc(100dvh - var(--topbar-total) - var(--bottombar-height));
  }

  html body .login-page-wrap {
    min-height: calc(100vh - var(--topbar-total));
    min-height: calc(100dvh - var(--topbar-total) - var(--bottombar-height));
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  html body .contact-container,
  html body .faq-container,
  html body .priv-container,
  html body .tos-container,
  html body .status-container,
  html body .updates-page-main,
  html body .users-page-main,
  html body .profile-page-main,
  html body .games-page-main,
  html body .shop-page-main,
  html body .news-page-main,
  html body .admin-page-main {
    padding-top: 16px;
    padding-bottom: 24px;
  }

  html body .login-page-wrap {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  html body .login-page-logo {
    width: 90px;
    margin-bottom: 12px;
  }

  .credits-hero {
    min-height: 0;
  }

  .credits-hero-art {
    padding: 16px;
  }

  .credits-hero-art img {
    width: auto;
    max-width: 70%;
    max-height: 40vh;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .rqplus-banner {
    min-height: 0;
  }

  .rqplus-banner-art {
    min-height: 0;
    padding: 12px;
  }

  .rqplus-banner-art img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 56vh;
  }

  .rqplus-banner-info {
    padding: 20px 22px;
  }
}
