/* Responsive rules provide compact layouts for phones and narrow browser windows.
   Wider tablet and desktop styling is defined by the page stylesheets. */

.roomRemovalNotice {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 5000;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(20,20,24,.96);
  border: 1px solid rgba(255,255,255,.12);
  color: #fff;
  box-shadow: 0 12px 35px rgba(0,0,0,.35);
  font-weight: 700;
}

/* ============================================================
   COMPACT-SCREEN OVERRIDES
   These apply through 800px so narrow browser windows use the mobile layout.
   Larger tablet, laptop and desktop resolutions are untouched.
   ============================================================ */
@media screen and (max-width: 800px) {
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    scrollbar-width: none;
  }

  html::-webkit-scrollbar,
  body::-webkit-scrollbar,
  *::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  body { min-height: 100vh; overflow-y: auto; }

  header, .header, #topNav {
    height: 58px;
    min-height: 58px;
    width: 100%;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 6px 8px;
    box-sizing: border-box;
  }

  #header {
    flex: 0 0 auto;
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(.95rem, 4.5vw, 1.2rem);
    white-space: nowrap;
  }

  #mobileSearchButton, #mobileMenuButton {
    display: flex !important;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    line-height: 1;
  }

  #mobileSearchButton { font-size: 2rem; }
  #mobileMenuButton { font-size: 1.55rem; }

  #searchDiv {
    display: none;
    position: fixed;
    top: 62px;
    left: 50%;
    right: auto;
    width: min(88vw, 320px);
    max-width: 320px;
    transform: translateX(-50%);
    z-index: 2200;
    padding: 7px;
    border-radius: 12px;
    background: var(--brown);
    box-shadow: 0 8px 24px rgba(0,0,0,.28);
    box-sizing: border-box;
  }

  header.search-open #searchDiv { display: flex; }

  #searchBar {
    width: 100%;
    min-width: 0;
    height: 38px;
    padding: 8px 12px;
    font-size: 1rem;
    border-radius: 9px;
    box-sizing: border-box;
  }

  #secondNav {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 46px;
    padding: 0;
    order: 0;
    justify-content: flex-end;
    gap: 4px;
  }

  #secondNav .wallet-nav {
    flex: 0 0 auto;
    margin: 0;
    padding: 5px 6px;
    font-size: .7rem;
    transform: translateX(4px);
  }

  #secondNav .wallet-nav + #userTag {
    margin-left: 8px;
  }

  #secondNav .browseTextWrapper { display: none; }
  #secondNav .navbarLinks { width: 40px; height: 40px; padding: 6px; }
  #secondNav #userTag {
    width: 72px; max-width: 72px; flex: 0 0 72px;
    height: 44px; padding: 7px 9px; border-radius: 22px;
  }
  #secondNav #userTagActivity { width: 13px; height: 13px; flex-basis: 13px; }
  #secondNav #userTag img { width: 25px; height: 25px; }
  #secondNav #themeSettingsSlot { display: flex !important; flex: 0 0 40px; width: 40px; height: 40px; margin: 0; }
  #secondNav #openNavBtn { width: 38px !important; height: 38px !important; min-width: 38px !important; min-height: 38px !important; }
  #secondNav #openNavBtn svg { width: 16px; height: 16px; }

  body:has(#sideNav) main,
  body:has(#sideNav) #bodyContainer,
  body:has(#sideNav) .profile-page,
  body:has(#sideNav) .challenge-wins-page,
  main, #main, .main, #bodyContainer {
    margin-left: 0;
    padding-top: 74px;
    padding-left: 10px;
    padding-right: 8px;
  }

  #sideNav, .sideNav {
    top: 0;
    left: calc(-1 * min(300px, 72vw));
    width: min(300px, 72vw);
    max-width: calc(100vw - 24px);
    height: 100dvh;
    max-height: 100dvh;
    padding-top: 58px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    align-items: stretch;
    border-right: 1px solid rgba(255,255,255,.10);
    box-shadow: 12px 0 34px rgba(0,0,0,.34);
    transition: left .24s ease;
    z-index: 2100;
  }

  #sideNav.open, .sideNav.open { left: 0; }

  #sideNav .sideNavHeader, .sideNav .sideNavHeader {
    display: flex; position: sticky; top: 0; z-index: 3;
    min-height: 54px; padding: 8px 14px; box-sizing: border-box;
    justify-content: space-between; align-items: center;
    background: var(--darkestBrown);
    border-bottom: 1px solid rgba(255,255,255,.10);
  }

  #sideNav .sideNavHeader > span, .sideNav .sideNavHeader > span {
    font-size: 1.1rem; font-weight: 800;
  }

  #sideNav .sideNavClose, .sideNav .sideNavClose {
    position: static; width: 36px; height: 36px; display: grid; place-items: center;
    flex: 0 0 36px; padding: 0; border: 0; border-radius: 10px;
    background: rgba(255,255,255,.06); color: var(--primary-font-color);
    font-size: 1.7rem; line-height: 1; opacity: 1;
  }

  #sideNav .sideNavCreate, .sideNav .sideNavCreate {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    min-height: 46px; margin: 12px 12px 16px; padding: 0 12px;
    box-sizing: border-box; border-radius: 11px; font-size: .95rem; font-weight: 800;
  }
  #sideNav .sideNavCreate span, .sideNav .sideNavCreate span { font-size: 1.45rem; }

  #sideNav > ul, .sideNav > ul {
    width: 100%; box-sizing: border-box; padding: 0 10px 22px; margin: 0;
  }

  #sideNav ul li.sideNavSection, .sideNav ul li.sideNavSection {
    margin: 15px 4px 6px; padding: 0 8px; font-size: .72rem; line-height: 1.2;
    letter-spacing: .08em; text-transform: uppercase; font-weight: 800; opacity: .68;
  }

  #sideNav ul li a, .sideNav ul li a {
    display: grid; grid-template-columns: 30px minmax(0,1fr); align-items: center;
    column-gap: 11px; width: 100%; min-height: 46px; margin: 2px 0; padding: 8px 10px;
    box-sizing: border-box; border-radius: 10px; justify-content: initial;
    font-size: .94rem; font-weight: 700; text-align: left;
  }

  #sideNav ul li a > img, .sideNav ul li a > img {
    width: 22px; height: 22px; min-width: 22px; min-height: 22px;
    max-width: 22px; max-height: 22px; justify-self: center; object-fit: contain;
  }
  #sideNav ul li a > span, .sideNav ul li a > span {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  #sideNav .sideNavEmoji, .sideNav .sideNavEmoji {
    width: 22px; min-width: 22px; text-align: center; justify-self: center;
    font-size: 1.05rem; line-height: 1;
  }
  #sideNav .hor_line, .sideNav .hor_line { width: 100%; height: 1px; margin: 13px 0; background: rgba(255,255,255,.10); }

  .chatPanel { right: 8px; bottom: 74px; width: min(430px, calc(100vw - 16px)); max-height: min(72vh,620px); }
  .openChatBtn { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
  .chatHeader { gap: 6px; padding: 12px; }
  .chatHeaderBadges { gap: 4px; }
  .chatBadge { font-size: .65rem; padding: 4px 7px; }
  .chatSidebar { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .chatTab { min-width: 0; font-size: .72rem; padding: 8px 5px; }
  .chatFooter { padding: 8px; }
  #globalChatInput { min-width: 0; }

  #themeSettingsSlot #openNavBtn {
    position: static; display: flex; width: 38px !important; height: 38px !important;
    padding: 0; font-size: 0 !important; border-radius: 50%; background: var(--brown);
    border: 1px solid var(--primary-background-color); box-shadow: inset 0 0 0 2px var(--darkerBrown); z-index: 2;
  }
  #themeSettingsSlot #openNavBtn::before { font-size: 1.35rem; }
}

@media screen and (max-width: 380px) {
  #sideNav, .sideNav {
    width: min(280px, 76vw);
    left: calc(-1 * min(280px, 76vw));
  }
  #sideNav ul li a, .sideNav ul li a { min-height: 44px; padding: 7px 8px; font-size: .9rem; }
  #sideNav ul li a > img, .sideNav ul li a > img, #sideNav .sideNavEmoji, .sideNav .sideNavEmoji {
    width: 21px; min-width: 21px; height: 21px;
  }
  #searchDiv { width: min(86vw,300px); }
}
