html {

  min-height: 100dvh;
  min-height: -webkit-fill-available;
  background: #1B1A17;
}

body {
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  background: #1B1A17;
}


img,
video,
svg {
  max-width: 100%;
  height: auto;
}


.is-touch .btn-primary,
.is-touch .btn-secondary,
.is-touch .sidebar__link {
  min-height: 44px; 
}


#sidebar,
#main,
.main-shell {
  transition: width 0.2s ease, margin 0.2s ease, padding 0.2s ease;
}


:root {
  --sidebar-width-mobile: 100%;
  --main-padding-mobile: 16px;
  --main-padding-tablet: 24px;
}


@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  #sidebar {
    width: var(--sidebar-width);
    padding: 20px 16px;
  }

  #main {
    margin-left: var(--sidebar-width);
  }

  .main-shell {
    padding: 24px 20px 36px;
  }

  .sidebar__text {
    font-size: 13px;
  }

  .sidebar__icon {
    width: 20px;
    height: 20px;
  }


  .social-activity__total-value {
    font-size: 44px;
  }

  .stake-tab__value {
    font-size: 32px;
  }

  .page-header h1 {
    font-size: 24px;
  }


  .map-stage {
    min-height: 500px;
  }


  .location-panel {
    width: min(280px, 85%);
    padding: 14px;
  }

  .location-panel__header h2 {
    font-size: 18px;
  }
}


@media (max-width: 768px) {

  body {
    overflow: auto;
    overflow-x: hidden;
  }

  #app {
    flex-direction: column;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
  }


  #sidebar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    height: auto;
    min-height: 56px;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 100;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }


  #sidebar::-webkit-scrollbar {
    display: none;
  }
  #sidebar {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }


  #main {
    margin-left: 0;
    width: 100%;
    min-height: calc(100dvh - 70px);
    min-height: calc(-webkit-fill-available - 70px);
  }

  .main-shell {
    padding: var(--main-padding-mobile);
    padding-bottom: 32px;
  }


  .sidebar__brand {
    flex-shrink: 0;
    flex-grow: 0;
    width: auto;
    min-width: 0;
    overflow: visible;
  }

  .sidebar__brand-logo {
    height: 32px;
    max-height: 36px;
    width: auto;
    object-fit: contain;
  }

  .sidebar__nav-group {
    flex-direction: row;
    gap: 2px;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
  }

  .sidebar__label {
    display: none;
  }

  .sidebar__links {
    flex-direction: row;
    gap: 2px;
    flex-wrap: nowrap;
    display: flex;
    align-items: center;
  }

  .sidebar__link {
    padding: 8px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }


  .sidebar__text {
    display: none;
  }

  .sidebar__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  .sidebar__profile {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    flex-shrink: 0;
    margin-left: auto;
  }
  
  .sidebar__profile .sidebar__link {
    padding: 8px;
  }


  .page-header h1 {
    font-size: 22px;
  }

  .social-activity__total-value {
    font-size: 36px;
  }

  .stake-tab__value {
    font-size: 28px;
  }

  .social-activity__hero h2 {
    font-size: 24px;
  }

  .card-grid,
  .profile-grid,
  .social-activity__metrics,
  .stake-tabs,
  .contributions__leaderboards {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .social-activity__leaderboard-grid {
    grid-template-columns: 1fr;
  }

  .page-shell--map {
    height: auto;
    min-height: calc(100dvh - 56px);
    display: flex;
    flex-direction: column;
    padding-bottom: 70px;
  }

  .map-stage {
    min-height: 280px;
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
  }

  .map-stage__inner {
    border-radius: 12px;
    flex: 1;
    min-height: 250px;
    position: relative;
    overflow: hidden;
  }
  
  .globe-container {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }
  
  .globe-container canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    touch-action: manipulation;
  }
  
  .labels-container {
    position: absolute !important;
    inset: 0 !important;
    pointer-events: none;
  }

  .location-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-width: none;
    max-height: 45vh;
    margin: 0;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
    border-radius: 16px 16px 0 0;
    z-index: 50;
    overflow-y: auto;
    transform: translateY(0);
    transition: transform 0.3s ease, max-height 0.3s ease;
  }
  
  .location-panel.is-collapsed {
    max-height: 60px;
    overflow: hidden;
  }
  
  .location-panel.is-collapsed .location-panel__header .muted,
  .location-panel.is-collapsed .location-panel__status,
  .location-panel.is-collapsed #location-form,
  .location-panel.is-collapsed .location-panel__change {
    display: none;
  }

  .location-panel__header {
    cursor: pointer;
  }
  
  .location-panel__header h2 {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .location-panel__header h2::after {
    content: '▼';
    font-size: 10px;
    opacity: 0.5;
    transition: transform 0.2s ease;
  }
  
  .location-panel.is-collapsed .location-panel__header h2::after {
    transform: rotate(180deg);
  }

  .stake-transaction {
    grid-template-columns: 1fr;
    gap: 8px;
    text-align: left;
  }

  .stake-transaction__amount {
    text-align: left;
  }

  .stake-tab {
    min-height: auto;
    padding: 14px;
  }

  .form-group input {
    font-size: 16px;
    padding: 14px 12px;
  }

  .btn-primary,
  .btn-secondary {
    padding: 14px 16px;
    font-size: 15px;
  }

  .modal-content {
    margin: 12px;
    padding: 20px;
    max-width: calc(100vw - 24px);
  }

  .login-modal__panel {
    width: calc(100% - 24px);
    max-width: 400px;
    padding: 24px 20px;
  }

  .social-activity__search-controls,
  .contributions__posts-search {
    grid-template-columns: 1fr;
  }

  .contributions__posts-search .form-group {
    min-width: 100%;
  }

  .contributions__posts-search button {
    width: 100%;
  }
}

@media (min-width: 401px) and (max-width: 430px) {
  .map-stage {
    min-height: 320px;
    max-height: 55dvh;
  }
  
  .map-stage__inner {
    min-height: 280px;
  }
  
  .location-panel {
    padding: 14px;
  }
  
  .page-header h1 {
    font-size: 22px;
  }
}

@media (min-width: 393px) and (max-width: 400px) {
  .map-stage {
    min-height: 300px;
    max-height: 52dvh;
  }
  
  .map-stage__inner {
    min-height: 260px;
  }
}

@media (max-width: 400px) {
  .main-shell {
    padding: 12px;
    padding-bottom: 24px;
  }

  #sidebar {
    padding: 8px 10px;
    gap: 4px;
  }

  .sidebar__brand {
    width: auto;
  }
  
  .sidebar__brand-logo {
    height: 28px;
    max-height: 32px;
  }

  .sidebar__link {
    padding: 6px;
  }

  .sidebar__icon {
    width: 18px;
    height: 18px;
  }

  .page-header h1 {
    font-size: 20px;
  }

  .social-activity__total-value {
    font-size: 32px;
  }

  .stake-tab__value {
    font-size: 24px;
  }

  .leaderboard-card {
    padding: 14px;
  }

  .leaderboard-card__header h2,
  .leaderboard-card__network {
    font-size: 16px;
  }

  .x-posts-grid {
    gap: 10px;
  }

  .x-post-card {
    padding: 12px;
  }

  .x-post-card__body {
    font-size: 13px;
  }
}

@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  #sidebar {
    padding: 8px 16px;
  }

  .sidebar__brand-logo {
    max-height: 28px;
  }

  .map-stage {
    min-height: 280px;
  }

  .page-shell--map {
    min-height: auto;
  }
}

@media (hover: none) {
  .sidebar__link:hover {
    background: transparent;
    transform: none;
  }

  .btn-primary:hover:not(:disabled),
  .btn-secondary:hover {
    transform: none;
  }

  .x-post-card:hover {
    transform: none;
  }
}

@supports (padding: max(0px)) {

  html, body {
    padding-bottom: env(safe-area-inset-bottom, 0);
    background-color: #1B1A17;
  }
  
  #app {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  
  @media (max-width: 768px) {
    #sidebar {
      padding-top: max(12px, env(safe-area-inset-top));
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
    }
    
    .main-shell {
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
      padding-bottom: max(32px, env(safe-area-inset-bottom));
    }
    

    .map-stage {
      padding-left: max(8px, env(safe-area-inset-left));
      padding-right: max(8px, env(safe-area-inset-right));
    }
    

  }
}


@supports (padding: env(safe-area-inset-top)) {
  @media (max-width: 430px) and (min-height: 800px) {
    #sidebar {
      padding-top: max(12px, calc(env(safe-area-inset-top) + 4px));
    }
  }
}


@media print {
  #sidebar {
    display: none;
  }

  #main {
    margin-left: 0;
  }

  .modal-overlay,
  .login-modal-overlay {
    display: none !important;
  }
}

