@media (pointer: coarse) and (max-width: 768px),
(pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  :root {
    --top-nav-height: 52px;
    --bottom-bar-height: 44px;
    --bottom-bar-margin: 0;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  html {
    font-size: 12px;
  }

  body {
    overflow-y: hidden;
  }

  body.add-layers-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    position: fixed !important;
    width: 100% !important;
    left: 0;
    right: 0;

  }

  /* TopBar */

  .top-bar {
    padding: 0 14px;
  }

  [data-bs-theme=light] .logo,
  [data-bs-theme=dark] .logo {
    background-image: url('/static/assets/welcome/logo-atlantic-mob.svg');
    width: 120px;
    height: var(--top-nav-height);
    background-size: 110px auto;
    background-position: left center;
    background-repeat: no-repeat;
  }

  .top-bar .menu {
    gap: 8px;
  }

  .top-bar .menu .menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 0px;
  }

  .top-bar .menu .menu-item .menu-icon {
    height: 22px;
    width: 22px;
    mask-size: contain;
  }

  .top-bar .menu .menu-mobile-button .menu-icon {
    height: 22px;
    width: 22px;
    background-color: var(--bs-body-color);
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
  }

  .top-bar .menu .menu-mobile-button .text {
    padding-top: 3px;
    font-size: 0.65em;
    line-height: 1.1;
    white-space: nowrap;
  }

  /* map */

  #map.leaflet-container {
    position: absolute !important;
    top: var(--top-nav-height) !important;
    left: 0 !important;
    bottom: calc(var(--bottom-bar-height) + var(--safe-bottom)) !important;
    height: auto !important;
  }

  .leaflet-bottom.leaflet-left {
    bottom: calc(var(--bottom-bar-height) + var(--safe-bottom) - 25px);
  }

    body.add-layers-open .leaflet-bottom.leaflet-left,
    body.add-layers-open .leaflet-bottom.leaflet-right {
      pointer-events: none;
      z-index: 0 !important;
    }

  /* Leaflet Controls */

  .leaflet-control.custom-control {
    padding: 0;
    gap: 6px;
  }

  /* Popups  */

  .popup-area {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .popup-area .popup {
    max-height: calc(100vh - var(--top-nav-height) - var(--bottom-bar-height) - 60px);
    display: flex;
    flex-direction: column;
  }

  .popup-area .popup .popup-body * {
    font-size: 12px;
  }

  /* Add layers - fullscreen*/

  .popup-area .popup#add-layers {
    position: fixed !important;
    top: var(--top-nav-height) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(var(--bottom-bar-height) + var(--safe-bottom)) !important;
    width: auto !important;
    height: auto !important;
    max-width: 100vw !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    z-index: 99999 !important;
    background: var(--color-000);
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  @supports (-webkit-touch-callout: none) {
    .popup-area .popup#add-layers {
      max-height: -webkit-fill-available !important;
    }
  }

  .popup-area .popup#add-layers .popup-header {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .popup-area .popup#add-layers .popup-body {
    height: calc(100% - 40px);
    max-height: none !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 10px;
    overscroll-behavior: contain;
  }

  /* Popup: Active Layers */

  .popup-area .popup#active-layers {
    position: relative;
    min-width: auto;
    max-width: auto;
    flex: 0 0 auto;
  }

  /* Add Layers: Sub-menu */

  .add-layers .gallery-content .gallery-item .gallery-item-icon {
    width: 40px;
    height: 40px;
  }

  /* Add Layers: List */

  .add-layers .layers .dataset {
    margin: 6px 0;
  }

  .add-layers .layers .layer {
    padding: 2px 0;
  }

  .add-layers .layers .layer .layer-label {
    font-size: 14px;
    white-space: normal;
  }


  .table>:not(caption)>*>*
  {
    font-size: 10px;
  }

  .add-layers .layers .layer .layer-icon,
  .add-layers .layers .layer .layer-info,
  .add-layers .layers .layer .layer-streamline,
  .add-layers .layers .layer .layer-historical {
    width: 16px;
    height: 16px;
  }

  .add-layers .layers .layer .layer-checkbox-plus-icon,
  .add-layers .layers .layer .layer-checkbox-minus-icon {
    margin-top: -3px;
    width: 16px;
    height: 16px;
  }


  .add-layers .layers-titlebar {
    padding: 1px 0px 2px 1px;
  }

  /* Active layers */

  .active-layers .clear-layers .clear-layers-button span {
    font-size: 12px;
  }

  .active-layer .active-layer-left-content-container .active-layer-status-content {
    margin-top: 10px;
  }

  .active-layer .active-layer-left-content-container .active-layer-dataset-content {
    font-size: 10px;
  }

  .active-layer .active-layer-right-content .active-layer-legend-container .active-layer-legend-values {
    font-size: 8px;
    margin: 0px -10px 0px 0px;
  }
  
  .active-layer .active-layer-right-content .active-layer-legend-container .active-layer-legend-div {
    width: 75px;

  }

  .active-layers .no-layers {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 0px;
  }

  /* Data Not Available */
  .data-not-available {
    padding: 8px 4px 8px 0px;

  }

  .data-not-available-text {
    font-size: 10px !important;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .data-not-available-date {
    padding: 1px 3px;
    font-size: 10px !important;

  }

  /* Popup close button */

  .popup-area .popup .popup-close {
    width: 20px;
    height: 20px;
  }

  /* Bottom bar */

  .bottom-bar {
    display: none;
  }

  body.has-map:not(.welcome-open) .bottom-bar {
    display: grid;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 6px 16px var(--safe-bottom) 16px;
    background-color: var(--color-g-050);
    box-sizing: border-box;
    min-height: calc(var(--bottom-bar-height) + var(--safe-bottom));
  }

  body.has-map:not(.welcome-open) .bottom-bar .slider-container {
    display: none !important;
  }

  body.has-map:not(.welcome-open) .bottom-bar .player {
    grid-column: 1;
    grid-row: 1 / span 2;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
  }

  .bottom-bar .player {
    gap: 8px;
  }

  body.has-map:not(.welcome-open) .bottom-bar .player .player-button .player-text {
    display: none;
    font-size: 14px;
  }

  body.has-map:not(.welcome-open) .bottom-bar .player .player-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
    font-size: 14px;
  }


  body.has-map:not(.welcome-open) .bottom-bar .player .player-button:nth-child(1)::after { content: "1 DAY"; }
  body.has-map:not(.welcome-open) .bottom-bar .player .player-button:nth-child(2)::after { content: "1H"; }
  body.has-map:not(.welcome-open) .bottom-bar .player .player-button:nth-child(3)::after { content: "1H"; }
  body.has-map:not(.welcome-open) .bottom-bar .player .player-button:nth-child(4)::after { content: "1 DAY"; }

  body.has-map:not(.welcome-open) .bottom-bar .calendar {
    grid-column: 2;
    grid-row: 1;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin: 0;
    font-size: 11px;
    min-width: 0;
  }

  body.has-map:not(.welcome-open) .bottom-bar .calendar .calendar-text {
    width: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
  }

  body.has-map:not(.welcome-open) .bottom-bar .location {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0px;
    margin: 0;
    font-size: 10px;
    min-width: 0;
    width: 175px;
  }

  body.has-map:not(.welcome-open) .bottom-bar .location .location-text {
    width: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
  }

  body.has-map:not(.welcome-open) .bottom-bar .location .current-location {
    width: 14px;
    height: 14px;
    filter: var(--primary-filter);
    cursor: pointer;
    flex: 0 0 auto;
  }

  .leaflet-bottom.leaflet-left {
    bottom: calc(var(--bottom-bar-height) + var(--safe-bottom) + 12px);
    left: 8px;
  }

  .base-layers.base-layers-shell {
    padding: 2px 2px;
    margin-block: -10px;
  }

  .base-layers.base-layers-shell .base-layers-panel {
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.toolbar-open #map.leaflet-container {
    left: 52px !important;
    width: calc(100% - 52px) !important;
  }

  /* Sidebar */
  #sidebar .input-container {
    padding: 8px;
  }

  #sidebar .sidebar-menu .sidebar-menu-button {
    font-size: 11px;
    padding: 4px 12px;
  }

  #sidebar .variable-select {
    font-size: 10px;
    margin-top: 0px;
    width: 145px;
  }

  #sidebar .secondary-variable-select {
    padding-right: 0px;
  }

  #sidebar .variable-clear-icon {
    margin-left: 12px;
  }

  /* Sidebar fullscreen no mobile */

  body.sidebar-open #sidebar {
    position: fixed;
    top: var(--top-nav-height);
    left: 0;
    right: 0;
    bottom: calc(var(--bottom-bar-height) + var(--safe-bottom));
    width: 100vw;
    height: calc(100vh - var(--top-nav-height) - var(--bottom-bar-height) - var(--safe-bottom));
    z-index: 9000;
    background: var(--color-000);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
  }

  body.sidebar-open #sidebar.d-none {
    display: block !important;
  }

  body.sidebar-open .leaflet-container {
    pointer-events: none;
  }

  .toolbar-popup .toolbar-popup-item {
    padding: 1px !important;
  }

  .toolbar-popup .toolbar-popup-minimap {
    width: 50px !important;
    height: 30px !important;
  }

  .toolbar-popup .toolbar-popup-label {
    font-size: 6px !important;
  }

  .share-toast,
  .shared-state-toast {
    left: 10px !important;
    width: calc(100vw - 20px);
    max-width: 300px;
    min-height: 36px;
  }

  .share-toast-icon-wrapper,
  .shared-state-toast-icon-wrapper {
    padding: 0 6px 0 8px;
  }

  .share-toast-icon,
  .shared-state-toast-icon {
    width: 18px;
    height: 18px;
  }

  .share-toast-message,
  .shared-state-toast-message {
    padding: 8px 10px 8px 0;
    font-size: 11px;
  }
}

@media (max-width: 380px) and (pointer: coarse) {

  :root {
    --bottom-bar-height: 44px;
  }

  body.has-map:not(.welcome-open) .bottom-bar {
    padding: 0 10px var(--safe-bottom) 10px;
    column-gap: 8px;
    row-gap: 4px;
  }

  body.has-map:not(.welcome-open) .bottom-bar .player {
    gap: 8px;
  }

  body.has-map:not(.welcome-open) .bottom-bar .player img {
    max-height: 14px;
  }

  body.has-map:not(.welcome-open) .bottom-bar .player .player-button::after {
    font-size: 14px;
  }

  body.has-map:not(.welcome-open) .bottom-bar .calendar {
    font-size: 14px;
  }

  body.has-map:not(.welcome-open) .bottom-bar .location {
    font-size: 14px;
  }

  body.has-map:not(.welcome-open) .bottom-bar .location .current-location {
    width: 16px;
    height: 16px;
  }

}