/* Potworki v0.0.89m1 — Burzowe Wrzosowiska: mobile viewport/HUD fix
   Desktop remains untouched. This file intentionally loads after heath.css. */

@media (max-width: 720px) {
  /* Wrzosowiska must use the real visible browser viewport, just like battle/auth.
     --app-height is maintained by scripts/features/mobile-viewport.js. */
  #heath-view.heath-exploration-view,
  #heath-view .heath-viewport {
    width: 100vw;
    height: var(--app-height, 100dvh) !important;
    min-height: var(--app-height, 100dvh) !important;
    max-height: var(--app-height, 100dvh);
    overflow: hidden;
  }

  /* Compact team HUD: same mobile idea as the older walked regions,
     but anchored left so it never collides with Region + Weather. */
  #heath-view .world-team-hud {
    left: 8px !important;
    right: auto !important;
    top: calc(8px + var(--mobile-safe-top, 0px)) !important;
    width: auto !important;
    max-width: 52vw !important;
    min-height: 0 !important;
    max-height: none !important;
    transform: none !important;
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 4px 6px !important;
    overflow: visible !important;
    border-radius: 13px !important;
    backdrop-filter: blur(5px);
  }

  #heath-view .world-team-hud::before { display: none !important; }

  #heath-view .hud-member {
    display: block !important;
    width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 2px !important;
    border-radius: 9px !important;
    flex: 0 0 36px;
  }

  #heath-view .hud-member + .hud-member { margin-top: 0 !important; }

  #heath-view .hud-portrait {
    width: 32px !important;
    height: 32px !important;
  }

  #heath-view .hud-member > div:last-child { display: none !important; }

  #heath-view .hud-member.active {
    border-color: #d8b75d !important;
    background: #d8b75d1f !important;
    box-shadow: 0 0 9px #d8b75d3d;
  }

  /* Region card: smaller and pinned to the opposite corner. */
  #heath-view .heath-location-chip {
    left: auto !important;
    right: 8px !important;
    top: calc(8px + var(--mobile-safe-top, 0px)) !important;
    max-width: 43vw !important;
    padding: 6px 8px !important;
    border-radius: 9px !important;
    font-size: .58rem !important;
    line-height: 1.12 !important;
    text-align: center;
  }

  /* Weather remains visible, but only the useful information fits on mobile. */
  #heath-view .heath-weather-hud {
    left: auto !important;
    right: 8px !important;
    top: calc(50px + var(--mobile-safe-top, 0px)) !important;
    width: min(43vw, 150px) !important;
    min-width: 0 !important;
    padding: 6px 8px !important;
    border-radius: 9px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1px 6px;
  }

  #heath-view .heath-weather-hud small {
    grid-column: 1 / -1;
    font-size: .42rem !important;
    line-height: 1 !important;
    letter-spacing: .12em !important;
  }

  #heath-view .heath-weather-hud strong,
  #heath-view .heath-weather-hud time {
    font-size: .68rem !important;
    line-height: 1.1 !important;
  }

  #heath-view .heath-weather-hud time {
    justify-self: end;
    white-space: nowrap;
  }

  #heath-view .heath-weather-hud span { display: none !important; }

  /* Touch instructions duplicate the actual tap controls and consume a lot of screen. */
  #heath-view .heath-help { display: none !important; }

  /* Keep the minimap, but make it a small orientation aid instead of a second HUD. */
  #heath-view .heath-minimap {
    right: 8px !important;
    bottom: calc(76px + var(--mobile-safe-bottom, 0px) + var(--ios-bottom-gap, 0px)) !important;
    width: 92px !important;
    height: 55px !important;
    border-radius: 8px !important;
    opacity: .74;
  }

  #heath-view .heath-minimap::after {
    font-size: .38rem !important;
    letter-spacing: .08em !important;
  }
}


/* Region III is a full world view, so the global Guardian Dock must be visible here too.
   The base guardian-dock.css predates Wrzosowiska and only whitelists hub/forest/swamp/cave. */
html body[data-active-view="heath"] #account-widget.guardian-dock:not([hidden]) {
  display: flex !important;
}

body[data-active-view="heath"] .guardian-home-button {
  border-color: #c9b87588;
}

/* Very narrow phones: shave a little more off the HUD. */
@media (max-width: 390px) {
  #heath-view .world-team-hud {
    max-width: 50vw !important;
    gap: 3px;
    padding: 3px 5px !important;
  }

  #heath-view .hud-member {
    width: 33px !important;
    height: 33px !important;
    min-height: 33px !important;
    flex-basis: 33px;
  }

  #heath-view .hud-portrait {
    width: 29px !important;
    height: 29px !important;
  }

  #heath-view .heath-location-chip {
    max-width: 45vw !important;
    font-size: .54rem !important;
  }

  #heath-view .heath-weather-hud {
    top: calc(47px + var(--mobile-safe-top, 0px)) !important;
    width: min(45vw, 142px) !important;
  }

  #heath-view .heath-minimap {
    width: 84px !important;
    height: 50px !important;
  }
}

/* Landscape phones: keep HUDs shallow and instructions hidden. */
@media (pointer: coarse) and (max-height: 500px) {
  #heath-view.heath-exploration-view,
  #heath-view .heath-viewport {
    height: var(--app-height, 100dvh) !important;
    min-height: var(--app-height, 100dvh) !important;
  }

  #heath-view .heath-help { display: none !important; }
  #heath-view .heath-minimap { width: 82px !important; height: 48px !important; }
}
